INode rotation using Python and MaxPlus

INode rotation using Python and MaxPlus

Anonymous
Not applicable
1,672 Views
5 Replies
Message 1 of 6

INode rotation using Python and MaxPlus

Anonymous
Not applicable

When using INode.SetLocalRotation or INode.SetWorldRotation or assigning rotation directly to INode.Rotation, the rotation gets added to the current rotation which seems somewhat contradictory to the names of the methods.

Is adding rotation supposed to be the intended behavior?


If it is then what is the simplest way of setting the absolute rotation using Python?

And why after just a few times of using any of the aforementioned methods the scale of rotated node starts to increase?

0 Likes
1,673 Views
5 Replies
Replies (5)
Message 2 of 6

mateusz.zelent
Participant
Participant

Hi,

 

have you solved this problem?

 

 

0 Likes
Message 3 of 6

Anonymous
Not applicable

Not really.
It seems to be a bug in 2018/19 versions (probably in earlier ones as well).
Not surprising considering the quality of Python API.
And it's 3dsMax so don't hold your breath waiting for the fix.
As a workaround, you can use INode.SetLocalTM

0 Likes
Message 4 of 6

mateusz.zelent
Participant
Participant

Hi, thanks for your response. 

 

I have found a answer how to do it, please look:

 

 

            MaxPlus.Core.EvalMAXScript("a = $'"+n.GetName()+"'.pos")
            MaxPlus.Core.EvalMAXScript("$'"+n.GetName()+"'.pivot  = $'"+n.GetName()+"'.center")
            MaxPlus.Core.EvalMAXScript("$'"+n.GetName()+"'.rotation = (quat " + str(float(vers_i[0])) + " "+ str(float(vers_i[1])) + " "+ str(float(vers_i[2])) + " "+ str(float(vers_i[3])) + ")")
            MaxPlus.Core.EvalMAXScript("$'"+n.GetName()+"'.pos = a")

but right know it seams the objcets rotates in strange way, not that i'm expecting. 

0 Likes
Message 5 of 6

mateusz.zelent
Participant
Participant

Ok, This solution works fine, but we have to remeber that 3dsmax has different order in Quat(x,y,z,w)

0 Likes
Message 6 of 6

istan
Advisor
Advisor

Due to the lacking documentation of MaxPlus Python documentation I did not even consider start using it. I am wondering to which SDK functions the SetLocalTM() and SetWorldTM() map to?! With SDK it's unlike clearer using SetNodeTM().

0 Likes