Collision Area

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
Andy54
Posts: 2
Joined: Sat Jan 21, 2012 8:07 pm

Collision Area

Post by Andy54 »

Hi, i'm pretty new to Irrlicht so forgive me if I'm not doing this correctly.

I've got some code working for my collision detection, however, I am having trouble with the area of the collision.

For example, I have a building in my game scene, and although the collision works, the camera goes through the walls a bit first before stopping. I'm assuming this has to do with setting the area for the collision, so wondered if anyone could point me in the right direction of what I must change in my code.

Code: Select all

ITriangleSelector* templeCollision = 0;
                templeCollision = smgr->createOctreeTriangleSelector(temple->getMesh(), temple, 20);
                temple->setTriangleSelector(templeCollision);
                ISceneNodeAnimator* coll3 = smgr->createCollisionResponseAnimator(templeCollision, camera1, 
                                vector3df(200,50,60),
                                vector3df(0,0,0),
                                vector3df(0,0,0));
                        templeCollision->drop();
                        camera1->addAnimator(coll3);
                        coll3->drop(); 
Thank you =]
MasterKira
Posts: 11
Joined: Mon Feb 07, 2011 7:40 am

Re: Collision Area

Post by MasterKira »

From the Refence:
public ISceneNodeAnimator CreateCollisionResponseAnimator(
ITriangleSelector world,
ISceneNode sceneNode,
Vector3D ellipsoidRadius,
Vector3D gravityPerSecond,
Vector3D ellipsoidTranslation,
float slidingValue
);
In your code the "ellipsoidRadius" is set to:
vector3df(200,50,60)
Probably the nearest draw point of camera is far than this ellipsoid dimensions, try to raise them, for example to a (250,100,100)
You can try and try and try dimensions untill resolved

Lets hope it works...
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Collision Area

Post by jaworekplay »

Try smaller values, perhaps when you load the level camera is already closer than the elipsoid range.
Post Reply