I have created a 3d map but into it there are also some objects.
My problem is that when i want to collide a char with all this objects.
Now.. It's my problem, but i have not understood how to make it!
Help me thanks!
Collisions
You might have been best posting this in the Beginners Help section of these forums, as the collision detection tutorial explains most of what I think you're trying to do. Have a look at that, but use a meta triangle selector instead.
Make a triangle selector for each object in the scene you want to collide with and add each one to your meta triangle selector. Then create a colision response animator using your meta triangle selector. Add this animator to the character you want to collide with things. The pseudo code below shows something like what i think you need, but it might have bugs in it as i haven't checked it
If you're want to collide with an object with a large number of polygons (e.g. the level), use an octTreeTriangleSelector.
Hope that helps
Make a triangle selector for each object in the scene you want to collide with and add each one to your meta triangle selector. Then create a colision response animator using your meta triangle selector. Add this animator to the character you want to collide with things. The pseudo code below shows something like what i think you need, but it might have bugs in it as i haven't checked it
Code: Select all
ITriangleSelector* selector = 0;
IMetaTriangleSelector* meta = 0;
// Make a meta triangle selector
meta = smgr->createMetaTriangleSelector();
// Create a triangle selector for each scene object
// and add it to the meta triangle selector
for (/* The number of objects in the scene*/)
{
selector = smgr->createTreeTriangleSelector(aMesh, aNode);
aNode->setTriangleSelector(selector);
meta->addtriangleSelector(selector);
selector->drop();
}
// Then create a collision response animator, and attach
// it to yourNode, being whatever node you want things to
// collide with
ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(meta, yourNode);
yourNode->addAnimator(anim);
anim->drop();
// Then drop the meta selector if you don't need it
meta->drop();
Hope that helps