TreeCollision does not cover the entire mesh

Acid_Gambit

30-03-2007 22:54:51

I have a problem with one of my custom meshes (terrain of 500x10x500). When I create a TreeCollision body for my node it is only covering about 50% of the node width (see screenshot for explanation).



I am sure the collision does not work for the part that doesn't show the debug lines (tested by pushing an object over the terrain).

O, and here's my code:


Entity* floor;
SceneNode* floornode;
floor = mSceneMgr->createEntity("Floor", "terrain500x10x500.mesh" );
floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" );
floornode->attachObject( floor );
floor->setMaterialName( "Simple/BeachStones" );

floor->setCastShadows( false );

OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floornode, true );
OgreNewt::Body* bod = new OgreNewt::Body( m_World, col );
delete col;

bod->attachToNode( floornode );
bod->setPositionOrientation( Ogre::Vector3(0.0,-60.0,0.0), Ogre::Quaternion::IDENTITY );

Langhole

31-03-2007 04:48:58

Have you tried any alternate OgreNewt::CollisionPrimitives? such as ConvexHull? might be worth a shot...

Acid_Gambit

31-03-2007 13:26:02

Is there a method to get the vertex position data of a mesh? Because just using ::ConvexHull( mWorld, floornode ); isn't giving me the result I am looking for. It does wrap around the entire mesh now but I've lost a lot of the terrain's characteristics.

Tubez

31-03-2007 15:23:07

You lose all the concave bits. That's expected behaviour for a convex hull.

I cant say i've seen the effect in your first picture before. Could it be a worldsize issue?

nikhil

02-04-2007 10:59:50

You lose all the concave bits. That's expected behaviour for a convex hull.

I cant say i've seen the effect in your first picture before. Could it be a worldsize issue?


I was gonna say the same thing.. bt then wouldn't it have affected the convex hull thingy too.. ??? weird indeed..

try setting the optimization to false
TreeCollision( m_World, floornode, false );