Several CollisionResponseAnimator 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
BMF
Posts: 62
Joined: Mon Jul 16, 2007 11:10 am
Location: Spain
Contact:

Several CollisionResponseAnimator problem

Post by BMF »

Hello people,

I've been playing with Irrlicht the last few days, learning the basics, both reading the API and experimenting with the examples (which are
really useful, I may add), but on my latest experiment, I haven't been too.. succesful. I'm sure it's a very simple problem, but being the Irrlicht
newbie I am, I need some external help to solve it. So:

I have my 'nd_floor' scene node, and a 'nd_car' scene node. 'nd_floor' is the track, basically.
So I wanted to use some fancy CollisionResponseAnimator, and first, set a triangle selector, with:

Code: Select all

ITriangleSelector* selector = 0;
selector = irrSceneMgr->createOctTreeTriangleSelector(mesh->getMesh(0), nd_floor, 128);
nd_floor->setTriangleSelector(selector);
selector->drop();
To then tell my car not to go through walls and be affected by gravity with:

Code: Select all

aabbox3d<f32> box = nd_car->getBoundingBox();
vector3df radius = box.MaxEdge - box.getCenter();
	
ISceneNodeAnimator* anim = irrSceneMgr->createCollisionResponseAnimator(selector, nd_car, radius, vector3df(0,-1,0), vector3df(0,0,0));
nd_car->addAnimator(anim);
anim->drop();	
So far so good! The car is driven across the track smoothly and collides with walls. Irrlichtly cool!

But now my problem comes. I wanted to add another track ('nd_castle') next to the current one (you could go from one to the other one, since they are directly connected with no walls in between).
So I did it the same way as before:

Code: Select all

ITriangleSelector* selector2 = 0;
selector2 = irrSceneMgr->createOctTreeTriangleSelector(mesh->getMesh(0), nd_castle, 128);
nd_castle->setTriangleSelector(selector2);
selector2->drop();


and:

Code: Select all

ISceneNodeAnimator* anim2 = irrSceneMgr->createCollisionResponseAnimator(selector2, nd_car, radius, vector3df(0,-1,0), vector3df(0,0,0));
nd_car->addAnimator(anim2);
anim2->drop();
But that, apparently, is not the way to do such a thing.
Now the car works well when on nd_castle, but kind of 'shakes' when on nd_floor.. or vice-versa, if I place nd_castle's code before nd_floor's.

I wonder why is this. Can't a node have several CollisionResponseAnimator, maybe? What specially puzzles me is that it doesn't completely stop working..
but gets kind of shaky, in a weird way.

Help would be much appreciated. Thanks in advance!

PD: If I wanted my car to response to collisions against other nodes (like other cars), how could I do it? I feel that the answer to my first question
would help me solve this one too, but since it wouldn't be static nodes now (other _moving_ cars), I'm not sure. Thanks again!
BAnd
Posts: 12
Joined: Fri Jul 06, 2007 5:58 pm

Post by BAnd »

same problem here
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

If you want more than 2 objects with collision response, you'll have to use a MetaTriangleSelector instead of a normal TriangleSelector !!! ;)

read the docu and/or search the forum for more infos... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
BMF
Posts: 62
Joined: Mon Jul 16, 2007 11:10 am
Location: Spain
Contact:

Post by BMF »

MetTriangleSelector, eh? Thanks, Acki, I'll give those a try. ;)
Post Reply