I'm making a little project using Irrlicht engine (using FPP camera) and I need:
1. to make CollisionResponseAnimator to avoid camera passing through the walls etc.
2. to make the second CollisionResponseAnimator and set on it the callback to call the function when collision with this object occurs.
The first issue I easily solved using the meta triangle selector like in tutorial and it works. Then I tried to do the second part and it also works but the 'world collision' doesn't They both won't to work. Here is the code of the second issue:
Code: Select all
class Item : ICollisionCallback
{
protected:
IrrlichtDevice* device;
IVideoDriver* driver;
ISceneManager* smgr;
vector3df pos;
IAnimatedMesh* mesh;
ISceneNode* node;
ITriangleSelector* selector;
ISceneNodeAnimatorCollisionResponse* collisionAnimator;
eItemType itemType;
public:
Item(IrrlichtDevice* irrDevice, eItemType ItemType, vector3df position);
bool onCollision(const ISceneNodeAnimatorCollisionResponse & animator);
};
Item::Item(IrrlichtDevice *irrDevice, eItemType ItemType, vector3df position)
{
device=irrDevice;
driver = device->getVideoDriver();
smgr = device ->getSceneManager();
(...)
selector=smgr->createOctreeTriangleSelector(mesh, node);
collisionAnimator= smgr->createCollisionResponseAnimator(selector, smgr->getActiveCamera());
smgr->getActiveCamera()->addAnimator(collisionAnimator);
collisionAnimator->setCollisionCallback(this);
}