|
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=0; i<numFrames; i++){
simTime = time[i]; angleRads = angle[i];
// get the controller Control *c_rot = node->GetTMController()->GetRotationController(); // create the new keyframe c_rot->AddNewKey(simTime, ADDKEY_INTERP); // get the key IBezQuatKey newKey; c_rot->GetValue(simTime, &newKey, FOREVER, CTRL_RELATIVE);
Point3 axis = *new Point3(1.0, 1.0, 0.0); axis = Normalize(axis); // set the new value newKey.val = QFromAngAxis( angleRads, axis); // store the value c_rot->SetValue(simTime, &newKey, 1, CTRL_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
|
|
|
Will Scott 14 December 2011 12:02 PM
Point3 axis = *new Point3(1.0, 1.0, 0.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.
|
|
|