[ODE] dBodyGetRotation
Jon Watte (ODE)
hplus-ode at mindcontrol.org
Wed Jul 12 13:11:32 MST 2006
The FAQ for ODE, as well as the documentation, states that the "offset"
part of the mass is ignored for a body.
Also, you're setting the rotation of the MASS, which only affects the
inertia tensor. You want to set the body rotation matrix to a specific
value if you want the body to be rotated to that orientation. If you
want to introduce spinning (continuous rotation) to a body, you instead
need to add a torque, or perhaps set the angular velocity.
Cheers,
/ h+
adastra at inorbit.com wrote:
>
> Hi Everyone,
> I have a problem with the dBodyGetRotation function (ode 4.2)
>
> I set the position and the rotation of my ode body to the correct
> position/rotation, I know this because I checked it with TRACE.
> I got no collision figure so I checked that the body was infact
> rotating according to the matrix I passed into it and, nope, nothing.
> Is this an ODE problem or a me problem?!
>
> Here's a bit of my code:
>
> vtkMatrix4x4 *indexprot = transformIndexp->GetMatrix();
> indexprot->GetElement(0,0),indexprot->GetElement(0,1),indexprot->GetElement(0,2),
> indexprot->GetElement(1,0),indexprot->GetElement(1,1),indexprot->GetElement(1,2),
> indexprot->GetElement(2,0),indexprot->GetElement(2,1),indexprot->GetElement(2,2));
>
> dMatrix3 indexmatrix;
>
> for (int indexmatrixrot1=0; indexmatrixrot1<3; indexmatrixrot1++) {
> for (int indexmatrixrot2=0; indexmatrixrot2<3; indexmatrixrot2++) {
> indexmatrix[indexmatrixrot1*3+indexmatrixrot2] =
> indexprot->GetElement(indexmatrixrot1, indexmatrixrot2);
> }
> }
>
> dReal odeip_x = indexprot->GetElement(0,3);
> dReal odeip_y = indexprot->GetElement(1,3);
> dReal odeip_z = indexprot->GetElement(2,3);
>
> dBodySetPosition(handbody[3], odeip_x, odeip_y, odeip_z);
> dBodySetRotation(handbody[3],indexmatrix);
> dMassTranslate(&m, odeip_x, odeip_y, odeip_z);
> dMassRotate(&m, indexmatrix);
>
> TRACE("ODE position is %f, %f, %f\n",odeip_x,odeip_y,odeip_z);
> const dReal *bodyrot = dBodyGetRotation(handbody[3]);
> TRACE("ODE rotation is\n %f, %f, %f,\n %f, %f, %f,\n %f, %f, %f\n",
> indexmatrix[0], indexmatrix[1], indexmatrix[2],
> indexmatrix[3], indexmatrix[4], indexmatrix[5],
> indexmatrix[6], indexmatrix[7], indexmatrix[8]);
>
> TRACE("ODE rotation is\n %f, %f, %f,\n %f, %f, %f,\n %f, %f, %f\n
> %f %f %f\n",
> bodyrot[0], bodyrot[1], bodyrot[2],
> bodyrot[3], bodyrot[4], bodyrot[5],
> bodyrot[6], bodyrot[7], bodyrot[8],
> bodyrot[9], bodyrot[10], bodyrot[11]);
>
> Cheers,
> Jemma
>
>
> --
>
> ___________________________________________________
> Play 100s of games for FREE! http://games.mail.com/
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
More information about the ODE
mailing list