Hello Alexandra,
Alexandra Wolyniec wrote:
> Hello!
> The animation of the translation is working right now. Thank you, also for
> the explications.
> Now I'm trying to use the slerpThis-function to animate a rotation. I'm not
> sure, if I passed the values right. Probably not, because it's not working
> :-) Thus, another easy problem to solve:
> I have written this function:
>
> void rotation_x(Quaternion cube_init_qua, Quaternion cube_end_qua, int
> frame_current, int frame_total){
> Matrix cube_move;
> cube_move.setIdentity();
> Quaternion q;
>
> float slerp_value = frame_current/frame_total; //to get a value
> between 0 and 1
>
> beginEditCP(cube_trans, Transform::MatrixFieldMask);
> q.slerpThis(cube_init_qua,cube_end_qua,slerp_value);
> cube_move.setTransform(cube_init,q); //cube_init =
> Vec3f(0,10,0)
> cube_trans->setMatrix(cube_move);
> endEditCP(cube_trans, Transform::MatrixFieldMask);
> }
>
> And this is being called by
>
> rotation_x(Quaternion(Vec3f(1,0,0),0), Quaternion(Vec3f(1,0,0),30),
^^^
unless noted otherwise, angles in OpenSG are in
radians, use
osgdegree2rad and osgrad2degree to convert.
> frame_current, frame_total);
>
> in the display-Function.
hm, I can not really spot anything besides the rad/degree problem above.
If that does not solve your problem, your best bet is to put some printf
or std::cerr statements to print q and cube_move and look at the values
to see if they are what you'd expect.
Hope it helps,
Carsten
-------------------------------------------------------------------------
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