Collision Detection Problem

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
barakatx2
Posts: 14
Joined: Tue Aug 24, 2010 7:00 am

Collision Detection Problem

Post by barakatx2 »

I am trying to set up a collision response animator with my terrain mesh. To set up the collision I did what the tutorial basically did:

Code: Select all

scene::IMeshSceneNode* node = smgr->addMeshSceneNode(mesh);
node->setMaterialFlag(video::EMF_LIGHTING,false);
scene::ITriangleSelector* tri = smgr->createTriangleSelector(mesh,node);
node->setTriangleSelector(tri);

scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0,100.0f,0.5f,0,0,0,false,3.0f,false,true);
cam->setPosition(core::vector3df(0.0f,10.0f,0.0f));

scene::ISceneNodeAnimator* coll = smgr->createCollisionResponseAnimator( tri, cam, core::vector3df(30,50,30), core::vector3df(0,-10,0), core::vector3df(0,30,0));
cam->addAnimator(coll);
The problem is that the camera does not move and when I use the movement keys the camera just jerks a tiny bit and does not leave the starting position. Any ideas?
RuggJack93
Posts: 39
Joined: Mon Sep 06, 2010 5:09 pm
Location: Italy

Post by RuggJack93 »

You've done all correctly, but there are some things you could try:

1 - drop the triangle selector when you don't need it anymore (from the code you posted it seems that you haven't done it, but maybe you've done after that piece of code);

2 - Try to reduce the gravity vector to -6 (well, try to reduce the gravity);

3 - Reduce a bit the camera speed;

4 - Try to put a higher initial position to your camera;

5 - Load your model as Octree and use an OctreeTriangleSelector (but I think this wouldn't change thing much ...)

6 - If you use blender, try to bake a heightmap of your terrain mesh following this tutorial here: http://en.wikibooks.org/wiki/Blender_3D ... _Heightmap

then use the terrain scene node and the terrain triangle selector for the collision

Hope it helps, good luck :) !
blAaarg
Posts: 94
Joined: Tue Mar 02, 2010 9:11 pm
Location: SoCal

Post by blAaarg »

Also, your ellipsoidRadius might be too big for its starting point in the environment, maybe.

I've seen the shake 'n' shutter effect of that before. :(
"Computers don't make mistakes! What they do they do on purpose!!"

-Dale Gribble
Post Reply