Is maxscript “rotate” command available in the SDK?
Rotate command (SDK,C#)
um… it seems too complicated, I only have a Quat value.
How I can use that like the MaxScript one?
Rotate node value(quat)
Welcome to the SDK realm, my friend. If you wish to dwell here, tread by its laws.
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.
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
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
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);
Latest correction:
com_node.Move(insert_time, tmAxis, pos1.DecreaseBy(pos2).DivideBy(2), false, true, 0, false);
it seems final position has a little offset from what it should be. Do I have any problem in formula?