Lee, Andrew Hickinbottom (3D) Tank Girl, Pedro Conti (2D)

View Full Version : Wiring a slider to a bones rotation - parent offset issues

Rick Stirling
04-23-2008, 04:43 PM
I've written a script that takes the values from a slider and wires that to a bone. It's wrapped up in a nice little function that allows me to pass in an angle limit, and this works - if I pass in 20 degrees, I get 20 degrees of rotation in both directions.

However, as soon as I perform the wiring, the bone will rotate to an arbitrary rotation and that becomes it new default position. This happens when I wire by script or by using the default max interface.

I know that I have to apply an offset fix, but I can't figure out how to get this offset so that I can apply it. I thought that I'd simply grab the intial rotation of the bone and then use that, but I'm working in Parent space since the bone is in a hierarcy...

"thebone.transform.rotation as eulerangles" returns the rotation in world space, using world axis.

I've tried "in coordsys parent thebone.transform.rotation as eulerangles", but that returns the same value.

So, how do I get the parent space rotation values of a bone?

I know that I'll also need to shuffle the axis, because my rotations happen in local space.

Rick Stirling
04-23-2008, 04:56 PM
I THINK I've progressed a bit

rx = thebone.rotation.x_rotation in coordsys parent
ry = thebone.rotation.y_rotation in coordsys parent
rz = thebone.rotation.z_rotation in coordsys parent

CGTalk Moderation
04-23-2008, 04:56 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.