nikhil
15-10-2006 03:55:46
Hi
I'm tryin to basically get a ball to fall down and hit the mesh below.. The ball isn't responding to the following code:
I've created a listener for physics.. which basically contains code from the basicFrameListener:-
I've the listener added to the root..
i'm using the exampleframework too..
I'm tryin to basically get a ball to fall down and hit the mesh below.. The ball isn't responding to the following code:
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Ellipsoid(m_World, Ogre::Vector3(1,1,1));
OgreNewt::Body* body = new OgreNewt::Body( m_World, col );
Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcSphereSolid( 10.0, 1.0 );
body->setMassMatrix( 10.0, inertia );
body->attachToNode( mSceneMgr->getSceneNode("ballnode1") );
body->setStandardForceCallback();
body->setPositionOrientation(Vector3(0,150,130), Quaternion::IDENTITY);
I've created a listener for physics.. which basically contains code from the basicFrameListener:-
bool frameStarted(const FrameEvent& evt)
{
m_elapsed += evt.timeSinceLastFrame;
if ((m_elapsed > m_update) && (m_elapsed < (1.0f)) )
{
while (m_elapsed > m_update)
{
m_World->update( m_update );
m_elapsed -= m_update;
}
}
else
{
if (m_elapsed < (m_update))
{
// not enough time has passed this loop, so ignore for now.
}
else
{
m_World->update( m_elapsed );
m_elapsed = 0.0f; // reset the elapsed time so we don't become "eternally behind".
}
}
return true;
}
I've the listener added to the root..
i'm using the exampleframework too..