I start using IRRLICHT for my game from last month and hit to this terrain collision problem.
What I am doing is to make my mesh (IAnimatedMeshSceneNode) to walk on terrain by the build-in collision function getCollisionResultPosition
This is how I create terrain and selector
Code: Select all
terrain = smgr->addTerrainSceneNode("terrain/terrain-heightmap2.bmp");
terrain->setScale(core::vector3df(40.0f, 4.4f, 40.0f));
scene::ITriangleSelector* selector = smgr->createTerrainTriangleSelector(terrain, 0);
terrain->setTriangleSelector(selector);
Code: Select all
t = smgr->getSceneCollisionManager()->getCollisionResultPosition(
selector, p, radius, move, tri, b, (f32) (speed * time)/1000.0f , core::vector3df(0,-1,0));
node->setPosition( t );
PROBLEM
When I try running around, it is ok for a while, but then drop off the map ... I am subspecting that I am standing between two triangles. is that possible ? or because I am using scale in terrain ?
Anyone got any working source with getCollisionResultPosition & Terrain, can you please post in here ?
Thanks