View Full Version : Copy Rotation
10-16-2003, 02:07 PM
Anyone knows if there's a easy way to copy a rotation from one object to other in maxscript?.
Because if I try to copy straight the rotation from object A to object B like this sometimes makes strange things.
A.rotation = B. rotation
I even tried....
A.rotation = in coordsys local B.rotation
But just works sometimes...
P.S. Maybe a good link to a tutorial of the quad, euler rotation coordinates stuff?.
thank you very much in advance.
Yan Loong Wong
10-20-2003, 04:45 PM
depending on the type of rotation controller u have, the result is different. I only tried copying rotation keys between 2 objects that uses eulerXYZ as rotation, and i use these:
ObjectA.rotation.controller.x_rotation = ObjectB.rotation.controller.x_rotation
ObjectA.rotation.controller.y_rotation = ObjectB.rotation.controller.y_rotation
ObjectA.rotation.controller.z_rotation = ObjectB.rotation.controller.z_rotation
if they're both using TCB, i think just ObjectA.rotation = ObjectB.rotation would work.
hope this helps.
10-21-2003, 07:37 AM
It should work if you do this:
p = a.pos
a.rotation = inverse b.transform.rotation
a.pos = p
Rotation is an amazingly complex subject, and can be confusing at times. In 3D, you have left-hand coordinate systems and right-hand ones. The reason the above code works is that when you get the transform of an object with Maxscript it is returned in one coordinate system, but when you set the .rotation property it is performed in the other. Thus you have to invert the transform matrix of the 'source' to put it in the coordinate system that will give the expected result on the 'target'. And since setting rotations explicitly like this works in world space rather than local, you need to re-set the position after performing the rotation; otherwise your object will be moved off somewhere you're not expecting it to be.
If that clarifies anything, then I'm glad I could help! Otherwise, I hope I didn't confuse you further:surprised
Yan Loong Wong
10-22-2003, 09:56 PM
i'm confused....:shrug: , especially about inversing the transform. I've only use scripting on a case by case basis, can u explain a bit more about this whole transform idea if it's not too time consuming? thanx in advance.
p.s. sorry for giving out my cheap solution earlier:p
10-25-2003, 01:57 PM
[finally wasn't helpful]
11-18-2003, 04:15 AM
basically back is front, up is down, in is out but up is never over nor out. eh? lol
01-16-2006, 08:00 AM
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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.