Hello!
I'm wondering why my rotation jumps from 240 degrees forward or back (?) to 120
degrees.
Right now I have a function, with which I can control the rotation by pressing
a key several times. This works fine. But unfortunately after 240 steps, that
means after a rotation of 240° it takes a small jump to 120° not finishing the
animation of the rotation as it should until 360°.
In addition I have a problem of solving the rotation into the other direction.
It works only until 0 degrees then it stops. But I will work on it further,
because it's just a mathematical thing, I think. But maybe anyone has a hint?!
Concerning the main problem, I've programmed the following function:
void rotation_clip(TransformPtr t, int angle){
Matrix cube_move, temp;
cube_move.setIdentity();
temp.setIdentity();
Matrix cube_trans = t->getMatrix();
Quaternion q, scaleOri;
float x, y, z, w;
Vec3f trans, scale, center;
cube_trans.getTransform(trans, q, scale, scaleOri, center);
q.getValueAsAxisDeg(x, y, z, w);
cout << "deg2rad(w+angle)" << deg2rad(w+angle) << endl;
beginEditCP(t, Transform::MatrixFieldMask);
temp.setTransform(trans);
temp.setRotate(Quaternion(Vec3f(0,1,0),deg2rad(w+angle)));
cube_move.setValue(temp);
t->setMatrix(cube_move);
endEditCP(t, Transform::MatrixFieldMask);
}
So, I don't get into it... merci for helping!
Greetings,
alex-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users