[Closed] How to get world rotation with Link Constraint?
Hi all,
I want to have the rotation that is given by the Transform Type-In rollout, irrespectively of what controllers are currently assigned.
$.rotation.x_rotation gives me the current Euler X value of the selected object. But if you assign a Link Constraint to the object with another object as the target (and this target object has a rotation != 0,0,0), the MaxScript Listener doesn’t give me the correct rotation value (like in the Transform Type-In rollout) anymore. It seems like the result is the rotation dependant on the parent specified by the Link Constraint.
How can I make MaxScript to give the Euler rotation dependant on the world although the parent is not the world?
Thanks in advance for any help.
Ok got it. I knew it was too simple.
($.transform.rotation as eulerangles).x
($.transform.rotation as eulerangles).y
[size=1]($.transform.rotation as eulerangles).z
It just was a bit confusing that transform.rotation gives quat values. But converting to euler helps.
[/size]
The rule is transforms are relative to there parent, when an object has no parent – its parent is the scene root/world. Max controllers work in local space except for constraints which act a little different.
Transform.rotation give quaternion values because thats what its showing you – its the base property. For example you could do transform.rotation as eulerlangles etc… Euler Angles arent rotation – infact a rotation doesnt exist, only a fazer around a vector in angleaxis and quaternions with the unit vector. Everything else that defines rotation is a matrix comprised of vectors and a forths being position. Quats are slightly different.
Scale is a by product of the unit vector in conjunction with row [1][2][3] of the transform matrix. Scew is caused by this axis defined by rows [1][2][3], being non othogonalized, ie correctly adjecent to each other. Position, row[4] in the matrix is just an offset from the origin or parent.
So if a is parented to b, to show a’s world rotation you would do transform.rotation as eulerangles etc. To get its local rotation in respect to b (i.e its parent) you would just do a.rotation.controller.value etc.
Transfrom space is a fundemental to rigging, and especially transforming spaces.
cheers,
Thank you eek, I will need this stuff in the future more often as advanced custom rigging is definitely an option for our next project.
For this one, I just needed it to fix my little exporter script.