I have a simple humanoid mesh that I’ve rigged and am animating procedurally by reading in motion tracking sensor data. The procedural animation bit works, but since the length of the limb segments of the model do not necessarily match up with those of the person wearing the motion sensors I need a way to reconcile them.
A picture of the model I’m using can be found here:
I need to be able to access the different components of the model (e.g. the upper arm) in order to determine its length and orientation.
Somewhat related to this, I’d also like to be able to scale the arm to match up those of the motion capture subject. It’s looking like I’ll be lucky if I can just read the orientation of the actor geoms and will need to resort to procedurally creating a model. If so, any tips on how to create it and programmatically generate a skeleton for that model?
Thanks in advance for any help.
You aren’t talking about accessing the actor’s geom (which contains only vertex meshes), but actually its joints (which contains the information about scale, rotate, and translate).
You can access the joints in a mechanism very similar to the way you are (presumably) already controlling it procedurally. Panda’s interface for procedure control is controlJoint(), which provides write-only access to the joint; there is a similar method for read-only access called exposeJoint(). Presumably you will not call both functions on the same joint, since then exposeJoint() will just return exactly the same transform you have supplied with controlJoint(). (But if your goal is to query the static rest transform for the actor before you have animated any of it procedurally, it might make sense to use exposeJoint() for this first, followed by controlJoint() later.)
Be warned that controlJoint() and exposeJoint() are not exactly converses of each other: the default behavior for controlJoint() is to accept a local transform, while the default behavior for exposeJoint() is to return a global transform. But you can pass localTransform=1 to exposeJoint().
Incidentally, you can apply a scale along with the rotation and/or position when you are controlling a joint. The scale will affect the vertices in the expected way.
There are examples of using both controlJoint() and exposeJoint() in these forums and in some of the source tutorials.
Thanks for mentioning exposeJoint, I was trying to get the initial position of a joint using a node returned by a controlJoint call which was giving me incorrect coordinates.
I’ve read blurbs about procedural generation of models in Panda3D, but is there anyway to define joints as well?
Thanks again, your post helped me get moving.
Actually, now that you mention it, I believe controlJoint() will load the joint’s initial transform onto its node, so this should give the correct value. It will be a local transform, not a global transform.
It is certainly possible to define an entire Actor, joint hierarchy and all, procedurally. It’s complicated, though. You might find it easier to construct an egg file with the appropriate joint transforms, then load that egg file.
In the same case.
I want to access a geom names ‘bandana’.
because I want to set it to be double-sided polygons.
So at first I tried.>>
It’s not work. (compile error.)
(It works only the model that export to ‘Pose’ type)
but girl.egg is ‘Both’ type.
Is there another way to access the geoms?
Use egg-optchar -flag, as described in the manual.