[ODE] Why doesn't the ship it the floor?

Eric Champigny champeric at myrealbox.com
Tue Apr 27 00:43:17 MST 2004


Before calling dWorldStep(), you must do the collision detection and set 
the contact joints by calling dSpaceCollide(). Look at the examples 
included with the source code to see how it's done.


lfcsimoes wrote:

>One more complete newb question:
> 
>I have the following code defining a ship and a plane (floor). I just want
>the ship to fall and hit the floor (and probably bounce a little over it).
>The ship falls but never stops!!
>
>I think I might be doing some confusion on geoms and bodies. 
>
>The essential code is the following:
>
>	bool frameStarted(const FrameEvent& evt)
>    {
>		if (evt.timeSinceLastFrame>0) {
>			dWorldStep( world,evt.timeSinceLastFrame);
>			pos = new dReal(3);
>			pos = dBodyGetPosition(dship);
>			mShipNode->setPosition(pos[0],pos[1],pos[2]);
>		}	
>		return true;
>    }
>
>……
>
>class game3Application : public ExampleApplication
>{
>	protected:
>		void game3Application::createScene(void)
>		{
>			// Create a skybox
>			mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox");
>
>			//Create a ship
>   			mShip = mSceneMgr->createEntity("razor",
>"razor.mesh");
>			mShipNode =
>static_cast<SceneNode*>(mSceneMgr->getRootSceneNode()->createChild());
>			mShipNode->attachObject(mShip);
>			
>			// ODE settings
>			world=dWorldCreate();
>			dWorldSetGravity (world,0,-9.8f,0);
>			//dWorldSetCFM (world,1e-5);
>			//dWorldSetAutoDisableFlag (world,1);
>
>			//Create a space
>			space = dHashSpaceCreate (0); 
>
>			//Create the floor
>			floor = dCreatePlane(space, 0, 1, 0, 0);
>
>			//Create a ship body 300 units over the floor
>			dship = dBodyCreate(world);
>			dBodySetPosition(dship,0,300,0);
>			
>			//Create a geom. for the ship
>			dgship = dCreateBox(space,50,50,50);
>			//associate geom. and body
>			dGeomSetBody(dgship,dship);
>
>
>			//ambient light
>			mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5,
>0.5));
>
>			//camera settings
>	
>mCamera->setAutoTracking(true,mShipNode,Vector3::UNIT_Y);
>			mCamera->setPosition(100,0,100);
>		}
>
>Thank you very much.
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.530 / Virus Database: 325 - Release Date: 22-10-2003
> 
>
>
>_______________________________________________
>ODE mailing list
>ODE at q12.org
>http://q12.org/mailman/listinfo/ode
>


More information about the ODE mailing list