Noob problem with terrain collision

pomide

29-11-2006 04:34:30

I have recently started using OgreNewt. Currently I am trying to make a simple cylinder bounce on some 'terrain' I have. The terrain is merely a mesh of a hilly environment and not a heightmap. I created it in 3DS max if that matters... I followed the tutorial and set up everything correctly (I think). When the file runs, the cylinder falls towards the hilly terrain, but stops and hovers above it. Below is the type of collision I am using.

OgreNewt::Collision* hitTerrain = new OgreNewt::CollisionPrimitives::TreeCollision( mWorld, terrainNode, true );
OgreNewt::Body* base = new OgreNewt::Body( mWorld, hitTerrain );
base->attachToNode( terrainNode );
base->setPositionOrientation( Vector3(0,0,0), Ogre::Quaternion::IDENTITY );

Is there something I am missing as to why the cylinder does not hit the terrain? Any help would be appreciated.

nathanwilliams6

29-11-2006 12:21:16

perhaps the problem isnt the tree collision, but the size of the collision geometry of your cylinder ?

have you tried enabling the debug lines to see the size of the cylinder collision geometry ?

unclepauly

29-11-2006 14:43:55

i think nathanwilliams is right. i had the same problem when i first started using ogrenewt.

when the cylinder stops in 'mid air', hit F3. this will show you the debug lines he mentioned. it is possible the actual collision object is bigger than the actual visual mesh, and it is, of course, the collision object that hits the terrain, not the visual mesh