Align Orientation

Heyho,
I guess it's a simple thing, but i'm really unexperienced with rotations in max and don't get it:
I want to script a button that "snaps" my wrist-bone into the same orientation as my forearm-bone. Basically the same thing i can do with the align-tool (align local orientation on x,y,z axes).
How do I do this via script? I tried
"$Wrist.rotation = $Forearm.rotation"
or
"rot = $Forearm.rotation; rotate $Wrist rot"
but it only results in a mess :/
I was hoping for a script-equivalent to the align-tool...

Any hints?

Greetings

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
MarTroYx's picture

I you want to position and

I you want to position and rotate the object at the same time then your best bet is the .transform properties of the object since it incorporate pos, rot and scale at the same time...look for matrix3 value in maxscript help file !

if you want to set the value one at a time but don't want to see the result in the viewport, then your can do this from inside a with redraw off() context...

with redraw off (
object1.rotation.controller[1].value = object2.rotation.controller[1].value
object1.rotation.controller[2].value = object2.rotation.controller[2].value
object1.rotation.controller[3].value = object2.rotation.controller[3].value
)

Martin

br0t's picture

No one :( ? I can't use

No one :( ?
I can't use changing weights of constraints for this, because i wanna be able to simply snap and then animate manually.

So i simply want to transfer an objects orientation to another object, is there no easy way to do this?

I tried something like this:

object1.rotation.controller[1].value = object2.rotation.controller[1].value
object1.rotation.controller[2].value = object2.rotation.controller[2].value
object1.rotation.controller[3].value = object2.rotation.controller[3].value

It looks funny cause i can see every axis align to the other object one after another. It worked for simple new created Objects, but not for my Bones when they are part of a. IK-Chain or do have Constraints...I'm stuck!
Does somebody maybe a at least know a script that does this where i can have a look at how it was done? Something like the "align tools", but theyre encrypted -_-

Never get low & slow & out of ideas

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.