> Hi, I am using TGS inventor to make key frame animation
> using SoVRMLOrientationInterpolator.
> But I don't know how to set multiple keyValues.
>
> I know that type of keyValue is a SoMFRotation which has the method as
> follows.
>
> void setValues(int stat, int num, const SbRotation *newValues)
>
> It must be work. But I failed.
>
> What I would like to do is to translate VRML description as follows into
> C++ description.
>
> OrientationInterpolator{
> key [0 0 1]
> keyValue[ 0 1 0 0, 0 1 0 3.14 , 0 0 1 3.14 ]
> }
As far as I know it works. You didn't say exactly what problem you
are seeing or what code you are trying, but the most common problem
is doing static intialization of an array of complex objects. In
this case it's particularly tricky because constructing an SbRotation
from four floats causes the floats to be interpreted as a quaternion
(rather than axis/angle). I've found it easier/safer to use the
set1Value method instead, like this:
const int numval = 3;
static float axis[][3] = {{1,0,0},{0,1,0},{0,0,1}};
static float angle[] = {0, 3.14f, 3.14f};
SoVRMLOrientationInterpolator *pNode = new SoVRMLOrientationInterpolator;
for (int i = 0; i < numval; i++) {
pNode->keyValue.set1Value( i, SbRotation(axis[i],angle[i]) );
}
-Mike
TGS Inc, http://www.tgs.com
|