Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / SDK / Create Keyframe rotation
  RSS 2.0 ATOM  

Create Keyframe rotation
Rate this thread
 
62839
 
Permlink of this thread  
avatar
  • Total Posts: 2
  • Joined: 18 October 2011 05:52 PM

I am trying to create keyframes for objects from a file but my rotation algorithm is giving me serious problems.  Given an angle (angleRads in radians 0-2PI), I want to merely rotate in the xy plane. 

for (int i=0i<numFramesi++){
simTime 
time[i];
angleRads angle[i];

// get the controller
Control *c_rot node->GetTMController()->GetRotationController();
// create the new keyframe
c_rot->AddNewKey(simTimeADDKEY_INTERP);
// get the key
IBezQuatKey  newKey;
c_rot->GetValue(simTime, &newKeyFOREVER,  CTRL_RELATIVE);

Point3 axis = *new Point3(1.01.00.0);
axis Normalize(axis);
// set the new value
newKey.val QFromAngAxisangleRadsaxis);
// store the value
c_rot->SetValue(simTime, &newKey1CTRL_RELATIVE);
}

This appears to work in the range of 0-PI but I can’t seem to get it to work otherwise.  I tried to adjust the angle to be in the -PI->PI range but success eludes me.

Thanks in advance



Replies: 0
avatar

Will Scott 14 December 2011 12:02 PM
Point3 axis = *new Point3(1.01.00.0);

Well, I don’t know if that’s the reason, but this axis is not 0Z (which you’d need for rotating in XY). Also your syntax might lead to memory leaks.



Replies: 0