single question bout collision

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
C#er
Posts: 2
Joined: Sat Oct 13, 2007 12:26 am

single question bout collision

Post by C#er »

Hi for all

It's my first time to post a question here and I'm very new in IrrLicht. I'm trying to make a collision detection between 3DS meshes, but I didn't sucess in this task. Below is the code. Some one can help to solve this? I believe my code is very simple. I'm accostumating with this guy.

Code: Select all

IAnimatedMesh * Mesh = Gerenciador->getMesh("modelo.3DS");
   IAnimatedMesh * Mesh2 = Gerenciador->getMesh("modelo2.3DS");
   ISceneNode * Mesh2Node = NULL;
   //Mesh que espera colisão
   Mesh2Node = Gerenciador->addOctTreeSceneNode(Mesh2->getMesh(0));
   Mesh2Node->setPosition(vector3df(-5, 0, 0));
   selector = Gerenciador->createOctTreeTriangleSelector(Mesh2->getMesh(0), Mesh2Node, 400);
   Mesh2Node->setTriangleSelector(selector);
   selector->drop();
   NodoCena = Gerenciador->addAnimatedMeshSceneNode(Mesh);
   NodoCena->setPosition(vector3df(5, 0, 0));
   ISceneNodeAnimator * sceneAnimator = Gerenciador->createCollisionResponseAnimator(selector, NodoCena, vector3df(30,50,30), vector3df(0,0,0), vector3df(0,50,0));
   NodoCena->addAnimator(sceneAnimator);
   sceneAnimator->drop();
   IGUIEnvironment * Ambiente = DeviceTeste->getGUIEnvironment();
Thanks for the support.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: single question bout collision

Post by rogerborg »

Collision response animators performs ellipsoid<->mesh collisions, not a mesh<->mesh collision. There's no built in support for precise mesh<->mesh collisions in Irrlicht.

The code looks reasonable. It may just be the size and offset of the ellipsoid. Are these vectors actually based on the size of the "modelo.3DS" mesh?

Code: Select all

vector3df(30,50,30), [...] vector3df(0,50,0));
If not, then please look at the documentation for createCollisionResponseAnimator() for a hint about how to create an ellipsoid of an appropriate size.

Also, it would really help if you explained what you expect to happen, and what you actually see happening.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply