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();
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();
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();
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!