Panda3D Manual: Controlling a Joint ProcedurallySometimes one wishes to procedurally take control of a model's joint. For example, if you wish to force a character model's eyes to follow the mouse, you will need to procedurally take control of the neck and head. To achieve this, use controlJoint. myNodePath = actor.controlJoint(None,"modelRoot","Joint Name") This creates a dummy node. Every frame, the transform is copied from the dummy node into the joint. By setting the transform of the dummy node, you can control the joint. Normally, one would want to use You must store a local (not global) transform in the dummy node. In other words, the transform is relative to the joint's parent bone. If you are controlling the forearm of a model, for instance, the transform will be relative to the upperarm. The string "modelRoot" represents the name of the model node - the string "modelRoot" is usually the correct value. The string "Joint Name" represents the name of the joint. Typically it would be something like "Femur", or "Neck", or "L Finger1". This is usually set inside the modeling package. For example, in MAX, each object in the scene has a name, including the bones. If necessary, you can determine the joint names by scanning the egg file for strings like Cautions and limitationsPrior to Panda3D version 1.5, there were several important limitations to controlJoint(). These have been lifted as of Panda3D version 1.5.
© Carnegie Mellon University 2010 |