I readed the collision demo, and tried set collision to other characters which was added.
At the beginning I try to faerie character, but she is going down by gravitation. I think, i just forget something.
This is a fragment code modified by me:
Code: Select all
// Add an MD2 node, which uses vertex-based animation.
node = smgr->addAnimatedMeshSceneNode(smgr->getMesh("faerie.md2"),
0, IDFlag_IsPickable | IDFlag_IsHighlightable);
node->setPosition(core::vector3df(-90,-15,-140)); // Put its feet on the floor.
node->setScale(core::vector3df(1.6)); // Make it appear realistically scaled
node->setMD2Animation(scene::EMAT_POINT);
node->setAnimationSpeed(20.f);
material.setTexture(0, driver->getTexture("faerie2.bmp"));
//material.setFlag(video::EMF_NORMALIZE_NORMALS,true);
//material.setFlag(video::EMF_LIGHTING, true);
material.Lighting = true;
material.NormalizeNormals = true;
node->getMaterial(0) = material;
// Now create a triangle selector for it. The selector will know that it
// is associated with an animated node, and will update itself as necessary.
selector = smgr->createTriangleSelector(node);
if(selector)
{
node->setTriangleSelector(selector);
scene::ISceneNodeAnimator *anim = smgr->createCollisionResponseAnimator(selector, node, core::vector3df(10,10,10),
core::vector3df(0,-10,0), core::vector3df(0,10,0));
node->addAnimator(anim);
anim->drop();
selector->drop(); // We're done with this selector, so drop it now.
}