[SOLVED] no movement...

Ultima2876

12-10-2008 00:47:32

I'm pretty sure you guys have heard this before, hundreds of times, but I've got everything set up (roughly following the basics tutorial at http://www.ogre3d.org/wiki/index.php/Ne ... e_Dynamics), but I've got no movement at all. I've searched around and found that most people having this problem change the world size and this fixes it - now unless I'm doing it wrong, which is very possible, it's not working for me. I've also tried setting autofreeze to false for the body in question, and unfreezing it manually. Here's some code snippets:

OgreApplication::OgreApplication()
{
mWorld = new OgreNewt::World();
AxisAlignedBox physicsBox(Vector3(-10000, -10000, -10000), Vector3(10000, 10000, 10000));
mWorld->setWorldSize(physicsBox);
}


This is my constructor where I create the world and set the world size.

// CYLINDER BODY
size = Ogre::Vector3( 5, 2.5, 2.5 );
node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
ent = mSceneMgr->createEntity("cylinder_body", "cylinder.mesh" );
ent->setCastShadows(true);
node->attachObject( ent );
node->setScale( size );

// rigid body.
col = new OgreNewt::CollisionPrimitives::Cylinder( mWorld, 2.5, 5 );
OgreNewt::Body* bod = new OgreNewt::Body( mWorld, col );

Ogre::Real mass = 10.0;
Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcCylinderSolid( mass, 2.5, 5 );
bod->setMassMatrix( mass, inertia );

bod->attachToNode( node );

// initial position
bod->setPositionOrientation( Ogre::Vector3(0, 30, 0), Ogre::Quaternion::IDENTITY );

bod->setStandardForceCallback();

delete col;


This is where I set up my rigid body object.

void OgreApplication::createOgreListener()
{
mFrameListener = new OgreListener(mWindow, mCamera);
mRoot->addFrameListener(mFrameListener);

mOgreNewtListener = new OgreNewt::BasicFrameListener(mWindow, mSceneMgr, mWorld, 120);
mRoot->addFrameListener(mOgreNewtListener);
}


And this is where I set up the BasicFrameListener.

Any ideas what I'm doing wrong, because I can't figure it out for the life of me x_x

Thanks in advance, guys.

EDIT: Fixed it. It turns out that I made an amateurish and silly mistake - that's what happens when you don't do any C++ over the summer and go straight into Ogre3D. The problem was the "CreateOgreListener" function. It should have been called createFrameListener, and as such wasn't being called, so no frame listeners were being created. *rolleyes*