Page 1 of 1

Collision Detection (RESOLVED)

Posted: Sun Jul 08, 2007 9:26 pm
by MerlinCAM
(The problem was with the elipse parameters, they were incorrect. when i use the following... it works.
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, node, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
node->addAnimator(anim);
anim->drop();

Hello,

I'm using Irrlicht 1.3.1.

I have taken example 7 and placed a model in the scene. I have used a simple event handler to check key states and move the model in the main animation loop, this works fine. I have set a regular camera (not fps) to be a child of the model, and update the target of the camera in the main animation loop, this all seems to work correctly. My problem is with the collision detection,
I try to change the code from the example from camrea to node , and I cant get the animation to not go through walls ect. the example uses the following code:

//here is my animation code
//My animation is just this:
//node is declared as in the example
scene::IAnimatedMesh* anms = smgr->getMesh("../../media/sydney.md2");
node = smgr->addAnimatedMeshSceneNode(anms);
node->setPosition(core::vector3df(-70,0,-60));
node->setMD2Animation(scene::EMAT_RUN);
node->getMaterial(0) = material2;
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, anms, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
camera->addAnimator(anim);
anim->drop();



WHen I change the collision detection code from camera to anms, it dosent stop my model from going through walls ect.

Any help is appreciated.

Update:

Posted: Sun Jul 08, 2007 9:35 pm
by MerlinCAM
when I try this:

//attempt colision detection
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, node, core::vector3df(-10.0f, 10.0f, 0.0f),
core::vector3df(0,-3,0),
core::vector3df(-70,10,-60));
node->addAnimator(anim);
anim->drop();

my model will not move at all anymore.