[Closed] Set Parent Rotation
Hi,
I have an arm (two bones with a end) and I need to set the foreArm rotation (in parent mode) for x and y to 0.
I am able to get the parent rotation with
(tm=$.transform*inverse $.parent.transform) as eulerangles
I can’t set it though.
How is it done ?
Thanks in advance
can try this.
child = $
tm = (child.parent.transform)
newTm = matrix3 tm[1] tm[2] tm[3] (child.transform.pos)
child.transform = newTm
Hi Evil-Fish, and thanks for the reply.
Unfortunately, this works for the three rotation axis at the same time. I tried to save the z rotation before executing it, with something like
baseRot = child.rotation.z
I tried with “baseRot = in coordsys parent child.rotation.z” too, did not work either.
Is there a place I could learn about the inner working of max’s matrices and how they interact with parent/itself/world ? I believe this would give me the informations to solve this problem, am I right ?
So instead of setting the x and y to 0 and the z to 360 (which is the present result), I need the z rotation to “stay put”.
Thanks again : )
Er, correction – it works.
I missed a little part in my code
child = $
baseRot = in coordsys parent child.rotation.z_rotation
tm = (child.parent.transform)
newTm = matrix3 tm[1] tm[2] tm[3] (child.transform.pos)
child.transform = newTm
in coordsys parent child.rotation.z_rotation = baseRot --It missed the "in coordsys parent"
Thanks a lot, I’ve been looking for this for days !