I know this is a popular topic, and I’ve searched extensively but even with all of that information, I still cannot get my joint control work as intended.
My goal is to control one of the joints in world coordinates, so I can set it to the same orientation as the world. Now, I know that joints are stored as local transforms and that I can make Panda work for me by creating a nodepath hierarchy based on those joints. That way, if I set the rotation based on the world, it should do the appropriate transforms for me.
Except I can’t quite get it to work.
I have a basic animated model, and its joint hierarchy looks like this:
player
<skeleton>
Base hpr 1.66133 89.8603 178.339 trans -0.000564083 -0.175523 1.39111
Spine hpr 0 7.651 0 trans 0 0.619687 -0.14133
UpperArm.L hpr -178.126 -23.3147 -177.6 trans 0.383515 0.355083 0.0989534
LowerArm.L hpr -1.99828 -48.0996 -2.74372 trans 0 0.510121 0
Hand.L hpr 1.11921 -2.31335 -1.16677 trans 0 0.492569 0
UpperArm.R hpr 178.246 13.4539 178.735 trans -0.383515 0.355083 0.0989534
LowerArm.R hpr 0.960175 -35.608 1.75383 trans 0 0.510121 0
Hand.R hpr -7.90664 -8.76821 -12.6235 trans 0 0.492569 0
UpperLeg.L hpr -179.838 30.4395 -179.63 trans 0.115283 0.132332 -0.00205376
LowerLeg.L hpr 2.20218 30.4601 -1.73607 trans 0 0.73409 0
UpperLeg.R hpr -179.97 3.52013 179.011 trans -0.115283 0.132332 -0.00205375
LowerLeg.R hpr -2.83956 42.9173 1.88821 trans 0 0.73409 0
Leg.L hpr -5.077e-006 -69.7964 -180 trans -0.0957884 0.186403 0.0922465
Toe.L hpr 1.54104e-005 -88.6037 180 trans 0 0 -0.213355
Leg.R hpr -180 -54.9409 -1.63765e-006 trans 0.0946603 -0.635872 0.190287
Toe.R hpr 180 -56.0208 1.66145e-006 trans 0 0 -0.213355
So I am trying to control the Spine joint, in order that I can set its Hpr in global coordinates and have it automatically work back up the chain for me. From what I have found in the forums and what I understand, I should be doing something like this:
# expose the Base joint
self.jointBase = self.playerActor.exposeJoint (None, 'modelRoot', 'Base')
# create new nodepath for the spine joint (that we will control)
self.jointSpine = self.jointBase.attachNewNode ('Spine')
# expose the spine so we can get its transform
Spine = self.playerActor.exposeJoint (None, 'modelRoot', 'Spine')
# copy the joint transform over to the nodepath
self.jointSpine.setTransform (Spine.getTransform(self.jointBase))
# associate this nodepath with this joint
self.playerActor.controlJoint (self.jointSpine, 'modelRoot', 'Spine')
However, while working with self.playerSpine, it does not appear to be resolving correctly when set to world orientation.
I fear I am missing something really elementary here, so I wanted to ask and see if anyone knows what I am missing.