How to make 2 different collision responsers?

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
brubrunr1
Posts: 2
Joined: Wed Apr 28, 2010 9:14 pm
Location: Poland

How to make 2 different collision responsers?

Post by brubrunr1 »

Hi everyone,
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);
}
I don't know what is wrong, please help....
Post Reply