SimpleScene falls through floor

imtrobin

23-11-2006 19:43:56

Hi,

I'm integrating OgreODE into the Practical application without using framelisteners. I can get a box (crate.mesh) from simplescene to drop onto a floor plane successfully. I noticed the box mesh is of size 10x10x10 units so I tried changing scale of the boxgeometry. However, it will fall through the floor if the boxgeomtry is big (> 10)

This is my setup, which is mostly ripped from the SimpleScene demo, except where I scaled the box size.

// Create the ODE world
mWorld = new OgreOde::World (mSceneMgr);
mSpace = mWorld->getDefaultSpace ();
mWorld->setGravity (Vector3 (0,-9.80665,0));
mWorld->setCFM (10e-5);
mWorld->setERP (0.8);
mWorld->setAutoSleep (true);
mWorld->setContactCorrectionVelocity (1.0);
mWorld->setShowDebugObjects (true);

mStepper = new OgreOde::ForwardFixedInterpolatedQuickStepper (0.01);
mStepper->setAutomatic (OgreOde::Stepper::AutoMode_NotAutomatic, mRoot);
mStepper->setStepListener (&mOgreODEHandler);

// Create a default plane to act as the ground
mPlane = new OgreOde::InfinitePlaneGeometry
(Plane (Vector3 (0,1,0),0),mWorld->getDefaultSpace ());

// Create the visual representation
Entity * entity = mSceneMgr->createEntity ("TestBody", "crate.mesh") ;

SceneNode* node = mSceneMgr->getRootSceneNode ()->createChildSceneNode ("TestBody");

node->attachObject (entity);
entity->setNormaliseNormals (true);
entity->setCastShadows (true);

// Create a body associated with the node we created
mBody = new OgreOde::Body ();
node->attachObject (mBody);

//%%%%% THIS IS WHERE CHANGING THE SIZE WILL MAKE BOX FALL THROUGH FLOOR
// scale box
Vector3 size (50,50,50);

// this makes box bigger as box is 10x10x10
node->setScale (5,5,5);

mGeom = new OgreOde::BoxGeometry (size,mSpace);

OgreOde::BoxMass mass (10.0, size);
mass.setDensity (5.0,size);

mBody->setMass (mass);

// Tie the collision geometry to the physical body
mGeom->setBody (mBody);

// put box 100 units above ground
mBody->setPosition (Vector3 (50, 100, 0));

// In game loop, if step is using elapsed time, it will give assertion error
if (mStepper->step (0.01))
{
mWorld->synchronise ();
}

tuan kuranes

29-11-2006 14:39:43

Practical application
What's that ?


// In game loop, if step is using elapsed time, it will give assertion erro

remove the assert in code or use another stepper, and report results here.

imtrobin

29-11-2006 14:54:51

Practical application is the tutorial on the ogre wiki where there is no frame listeners events but a custom game loop

http://www.ogre3d.org/wiki/index.php/Pr ... pplication

The assert (in the other thread) has nothing to do with this falling through.

I tried the QuickStepper, ExactVariableQuickStepper, ForwardFixedQuickStepper with time step 0.01 and same results. It falls through.

tuan kuranes

29-11-2006 15:16:47

Did you try just modifying simplescene to use same big boxes, does it also falls through ?

imtrobin

29-11-2006 15:27:20

No, I didn't. I don't have a simplescene setup cos I use the precompiled version of ogre.

tuan kuranes

29-11-2006 15:51:24

Then do that first, so that you can find if it's related to your code or if it's an Ode or OgreOde problem.