Notifications
Clear all

[Closed] maxscript single axis rotation script

Hi,

Basicly,

I’ve made two objects: object001 and object002 – and what I want is to pass object001 z axis rotation to object002 z axis as well. I wanted to do it via script controller. So I wrote an expression for object002:
‘object001.rotation.z’ – pretty simple huh

Yet what Im getting when I rotate object001 is something like a half rotation in object002… also it gets to around 90 deegres and it bounces to the opposite site.

What am I doing wrong? Its just a simple orientation pass in a single axis.

However when You use wire parameters in the same manner it works perfectly.

4 Replies

‘.rotation’ actually returns a quaternion value of how the object is rotated in world space. Then with ‘.z’ you get the z component of that quaternion, not the value of the euler track that is controlling the object’s rotation.

If I understand your goal correctly and provided you’re dealing with an Euler_XYZ controller, ‘.rotation.Z_Rotation.track.value’ should access the value you need (in degrees, likely).

Things just aren’t simple when dealing with max’s subAnims. Sometimes you get a value in worldspace, sometimes not, sometimes rotation is interpreted as being in degrees, sometimes in radians, sometimes .z_rotation is the component of a worldspace rotation quaternion converted to euler values, sometimes it’s the subanim of the euler controller holding the actual z_rotation track…

Didn’t thought a simple orientation copy could be so problematic ;d

Thank You Zhalktis, that’s exactly what I needed,

However the object on which the script controller is put on (on the z axis), it still needs a quaternion value, I guess that object can be calculated with anothers expression, though its weird you can’t put for example the float_script() on the Z_rotation.track.value.controller ect. Expression like this “Direction_CTRL.rotation.Z_rotation.track.value/57.29” gives me a quaternion value that represents another objects rotation from degrees

I was just wondering how the ‘parameter wiring’ works with single axis when manual scripting doesnt.

These two ways of wiring have to give exactly the same result:


delete objects
t = dummy name:#target boxsize:[10,10,10] pos:[0,0,0]
s0 = dummy name:#source1 boxsize:[20,20,20] pos:[0,0,40]
s1 = dummy name:#source2 boxsize:[22,22,22] pos:[0,0,40]

s0.rotation.controller[3].controller = t.rotation.controller[3].controller
paramWire.connect t.rotation.controller[3] s1.rotation.controller[3] "Z_Rotation"  


Ohh, this is really usefull.

Thanks denisT!