I’m trying to control a 2-link ragdoll, the idea is to simulate the arm of a robot. If you’ve seen my other posts, I’ve been trying to move an armature in the GameEngine… I was still learning the basics in Blender; now I know it is not possible to control armatures in real time, so the only option is to control boxes, hope to be right about this, any comments are welcome.
I’m using a RigidBody Joint constraint (I want to check a 2D rotation to simplify the problem, hinge -> elbow) from the lower arm to the upper arm; and another one (hinge -> shoulder) from the upper arm to the “body”. I’m using the Up and Down arrows to move the lower arm and the Left and Right arrow to move the upper arm. All blocks are “dynamic” except for the body which is “static”. I can change the position/speed of the “shoulder” and the “elbow”, no problems there.
I thought that parenting the lower arm to the upper arm would be enough for blocking the rotation of the lower arm when moving the upper arm alone. When not parented both links rotate as they should but the lower arm does NOT follow the rotation of the upper arm. When parented the lower arm MOVES the upper arm which is NOT what I want; and when moving the upper arm then the lower arm follows, this part at least is what I wanted.
I’m attaching the .blend and the .py file is at the bottom of this messege. I hope you guys have some time to check this and thanks for your help.
import GameLogic as g cont = g.getCurrentController() own = cont.owner move = cont.actuators if own.name == "OBLArm": press1 = cont.sensors["up"] press0 = cont.sensors["dwn"] elif own.name == "OBUArm": press1 = cont.sensors["right"] press0 = cont.sensors["left"] if press1.positive: own['go'] = 1 elif press0.positive: own['go'] = 0 cont.deactivate(move) speed = move.dRot if own['go'] == 1: speed = speed + 0.005 else: speed = speed - 0.005 move.dRot = [0.0, 0.0, speed] cont.activate(move)
firstArm.blend (151 KB)