[ODE] Angular motor and axis newbie question

honza at jikos.cz honza at jikos.cz
Tue Nov 16 23:38:15 MST 2004

 i have troubles with angular motors and i didn't find answer to my 
stupid questions in archives (i bet it is there but ...)
I am simulating spaceship (so no gravity etc) as one body then i attach 
angular motor to it. It works just fine but when i rotate the body a 
little and then i try to rotate it again around another axis it looks like 
it is trying to rotate it according to "unrotated axis", but i want to 
rotate relative to body position.
I'll paste relevant code:

    motor = new ode::dAMotorJoint(manager->world->id());
    motor->attach( body->id(), 0);
    motor->setAxis(0, 1, 1,0,0);
    motor->setAxis(1, 1, 0,1,0);
    motor->setAxis(2, 1, 0,0,1);
    motor->setParam(ode::dParamFMax, 1);
    motor->setParam(ode::dParamFMax2, 1);
    motor->setParam(ode::dParamFMax3, 1);

When request on motor angular velocities sent:
    motor->setParam(ode::dParamVel, desiredAngVel[0]);
    motor->setParam(ode::dParamVel2, desiredAngVel[1]);
    motor->setParam(ode::dParamVel3, desiredAngVel[2]);

i thought that second parameter in setAxis is telling that axis are 
relative to the body. (anchored to the body .. as documentation says)

Can i use dAMotorEuler? I am scared of this line in doc
 Axis 0 must be anchored to the first body, axis 2 must be anchored to the 
second body.

Thanks a lot for your potential advice :)
Jan Kratochvil


More information about the ODE mailing list