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

Alexander Bisler abisler at igd.fhg.de
Tue Apr 27 11:09:14 MST 2004



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);

Shouldn't that be brackets ? (to allocate memory for an array)
pos = new dReal[3];

Otherwise, you just allocate 1 ellement and call it's constructor with the 
input value of 3 !


> 			pos = dBodyGetPosition(dship);
> 			mShipNode->setPosition(pos[0],pos[1],pos[2]);
> 		}	
> 		return true;
>     }



More information about the ODE mailing list