Page 1 of 1

Ground Collision Detection

Posted: Thu Apr 12, 2007 3:32 am
by Scelle
My character seems to get stuck on the ground on a flat space when running around my world and I cant figure why. The world was created in Terrain Generator and exported as a .obj file and I'm using the following code:
Yes most of it is from the tutorials :)

ITriangleSelector* selector = 0;

if (lvlNode)
{
...

selector = smgr->createOctTreeTriangleSelector(level->getMesh(0), lvlNode, 128);
lvlNode->setTriangleSelector(selector);
selector->drop();
}

node = smgr->addAnimatedMeshSceneNode( mesh );

...

aabbox3d<f32> box = node->getBoundingBox();
vector3df radius = box.MaxEdge - box.getCenter();


ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, node, radius,
vector3df(0,-2,0),
vector3df(0,0,0));
node->addAnimator(anim);
anim->drop();


When running downhill or up steep hills it seems to be fine, but its when the character runs over slightly bumpy terrain it gets stuck for some reason. Can anyone explain why and possibly help me stop it so she runs smoothly?

Posted: Fri Apr 13, 2007 6:05 am
by HondaDarrell
I have this problem aswell. I also notice with my custom movement control that when the user hits a wall the user goes through and snaps back.
Is there some method of solve these problems?

Posted: Fri Apr 13, 2007 6:15 am
by roxaz
you wont fix it. irrlicht has very basic collision detection so dont expect much. if you want physics then use tokamak, ode, newton or physx ;)

Posted: Sat Apr 14, 2007 2:31 pm
by HondaDarrell
I remember seeing a demo called "InfinateGame.zip" that seemed good at handling terrain clipping.
Does anyone remember the post for the example?

Posted: Sat Apr 14, 2007 3:15 pm
by HondaDarrell
Ah I found it, but it doesn't include source.

http://www.wc3jass.com/asger/page.php?10

Posted: Sat Apr 14, 2007 6:22 pm
by Conard
Have a look at the WoW Camera Snippet. It has collision detection and gravity, it works well for me.