Rotate command (SDK,C#)


#1

Is maxscript “rotate” command available in the SDK?


#2

docs says there’s PushStdCommandMode for this


#3

YES.

INode::Rotate

Biped Move All Mode (SDK,C#)
#4

um… it seems too complicated, I only have a Quat value.
How I can use that like the MaxScript one?
Rotate node value(quat)


#5

Welcome to the SDK realm, my friend. If you wish to dwell here, tread by its laws. :stuck_out_tongue_closed_eyes:

void Rotate(TimeValue t, const Matrix3& tmAxis, const Quat& val, BOOL localOrigin=FALSE, BOOL affectKids=TRUE, int pivMode=PIV_NONE, BOOL ignoreLocks=FALSE) {node->Rotate(t,tmAxis,val,localOrigin,pivMode,ignoreLocks);}

provide the time and the coordsys matrix (tmAxis) and use all optional arguments by default.

This is what the MXS does do for you.


#6

:wink: How I could do that? how I can convert a quat to the tmAxis ?


#7

quat is the quat…
the tmAxis is what you specify in MXS when you say:

in coordsys ...

for example,
#world - Matrix3(1)
#local - node->GetNodeTM
#sceen - max_ip()->GetActiveViewExp().GetAffineTM

… and so on


#8

Aha! I just confiused with the “const Quat& val”.
OK, that is rotation pivot somehow.


#9

let say I have a biped and I want to change position1 and rotation1 to position2 and rotation2 using Move and Rotate command:

            IPoint3 pos1 = iBipDriver.GetBipedPos(insert_time, com_node);
            IQuat rot1 = iBipDriver.GetBipedRot(insert_time, com_node,false);

            IMatrix3 tmAxis = global_interface.Matrix3.Create();
            com_node.Move(insert_time, tmAxis, pos2.DecreaseBy(pos1), false, true, 0, false);
            com_node.Rotate(insert_time, tmAxis, global_interface.Inverse(rot1).MultiplyBy(rot2), false, true, 0, false);

This is not working correctly


#10

I figure it out where is my mistake, I should make the world matrix correctly:

            IMatrix3 tmAxis = global_interface.Matrix3.Create();
            tmAxis.IdentityMatrix();
            com_node.Rotate(insert_time, tmAxis, rot1.MultiplyBy(rot2), false, true, 0, false);
            com_node.Move(insert_time, tmAxis, pos1.DecreaseBy(pos2).DivideBy(2), false, false, 0, false);

#11

Latest correction:

com_node.Move(insert_time, tmAxis, pos1.DecreaseBy(pos2).DivideBy(2), false, true, 0, false);


#12

it seems final position has a little offset from what it should be. Do I have any problem in formula?