Notifications
Clear all

[Closed] help using rotate

I trying to get my head around the rotate function…

Lets say I have a Box and i want to set its transform matrix to T i.e. like this…

with animate on ($box01.transform = T)

This is fine except that it will create keys for postion rotation and scale even though i only want to set a rotation key…

so I thought i could do something like this…

with animate on ( in coordsys $box01 rotate $Box01 (T * inverse $box01.transform).rotation )

ie find the differance of where you are and where you want to be, then rotate by this amount in your local coordsystem.

this doesn’t seem to work
want am i doing wrong?

5 Replies

After a lot of guess work. I’ve come up with someting that works (i.e. rotates you where you want to be and only sets rotation key)…

with Animate on (in coordsys (transmatrix $Box01.pos) $Box01.rotation = Conjugate T.rotation)

where T is the transform matrix of where you want to be in world space.

To be honest I have no clue why this works or what a conjugate is (other than it flips the sign of quat.x , quat.y , and quat.z)

Can anyone explain???

I’m still pretty fuzzy on this topic myself. But if you wanted to take a different approach, you could set one object’s rotation to that of another by using the following:

animate on (obj1.controller.rotation = obj2.controller.rotation)

Of course, you have to define “obj1” and “obj2” first, but that should work.

Ok so there are at least 4 differant ways of looking at rotations…
$box01.transform.rotation (which i understand)
$box01.rotation (which seems to be the conjugate of $box01.transform.rotation )
$box01.rotation.controller.keys[i].value

and $box01.controller.rotation (whatever this means…)

All of which give differant values
help:eek:

Are you looking for general theory, or are you trying to do something specific? There’s usually more than one way to do anything using MaxScript, so there could be any number of “correct” answers if you need a specific result. But if you’re just looking for more information to better understand rotations, I’m attaching a .pdf document that Kees Rijnen created a while ago. I don’t think it’s available on his site anymore, but luckily I have a local copy. It’s very informative and should help you out.

Thanks for the info. It’s just what I was after.:bowdown:

You’re right about there being many ways to do things. So far I’ve just stuck to using the transform matrix, which has served me very well over the last few years. But it just wasn’t going to work very well for my current task…

The pdf is pretty clear and is really going to save my neck. thanks again.