Skip to main content

History: GettingStartedWithOde

Source of version: 3 (current)

Copy to clipboard
            {img src="img/wiki_up/ODE_logo2.png" alt="" align="right"}
I try to learn Ogre and Ode by combining the examples (and not by using the OgreOde Wrapper) and I was looking for a way to transfer position and orientation info from ode to ogre:

This is the corresponding code snippet from the Ogre ReferenceApplication

// Get position & rotation from ODE
{CODE(wrap="1", colors="c++")}            const dReal* pos = mOdeBody->getPosition();
            const dReal* quat = mOdeBody->getQuaternion();{CODE}
Warning!
for me (on new versions of ODE, and 'mOdeBody' is a dBodyID) the above two lines should be:
{CODE(wrap="1", colors="c++")}            const dReal* pos = dBodyGetPosition(mOdeBody);
            const dReal* quat = dBodyGetQuaternion(mOdeBody);

            mSceneNode->setPosition((Real)pos[0], (Real)pos[1], (Real)pos[2]);
            mSceneNode->setOrientation((Real)quat[0], (Real)quat[1], 
                (Real)quat[2], (Real)quat[3]);
{CODE}