How do I make a node to collide with several other nodes.

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
yossi1981
Posts: 3
Joined: Sat May 02, 2009 9:44 pm

How do I make a node to collide with several other nodes.

Post by yossi1981 »

So I am having the tutorial that explain how to load a Q3 map , create a selector from it , and then use collision response animators on a node using that selector.Now lets assume I have two nodes , The camera and a Box located somewhere , I don't want that box to be part of the Q3 map (lets say it can disappear) , so the box can't be part of the Q3 map.Lets say I create a collision response animator both for Camera and the box The animator use both the Q3 map selector.Now I want that the Camera and the box will also collide with each other , But they don't , since the selector provides only the Q3 map triangles .What is the "Proper" way to do it? Should I create another selector for the box and then another animator for the camera based on the box selector? Does the engine provide a more convenient way to solve this problem?
ZCCdark203
Posts: 47
Joined: Fri May 15, 2009 3:26 pm
Contact:

Post by ZCCdark203 »

You might want to take a look at IMetaTriangleSelector. It's an interface for making multiple triangle selectors work together as one selector. That means that you can have separate ITriangleSelectors for all three nodes. And per node you can specify, through the IMetaTriangleSelector, with which other nodes it can collide.

Code: Select all

camTriSelector = sceneManager->createTriangleSelectorFromBoundingBox(camera);
camMetaSelector = sceneManager->createMetaTriangleSelector();

... // Repeat the same for q3 and box.

camMetaSelector->addTriangleSelector(q3TriSelector);
camMetaSelector->addTriangleSelector(boxSelector);
camera->setTriangleSelector(camMetaSelector);

... // Repeat the same for q3 and box.

... //Don't forget to clean up: drop what you no longer need.
I'm not sure whether this is the "proper" way, but hopefully it helps you in some way.
Post Reply