collision problem

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
m4tricol
Posts: 11
Joined: Thu Nov 29, 2007 9:18 am

collision problem

Post by m4tricol »

Hi , I have a little problem,

code:

Code: Select all

IAnimatedMesh* mesh =myscene->getMesh("floor.3DS");
node=myscene->addAnimatedMeshSceneNode(mesh,0,FLOOR);
node->setMaterialFlag(EMF_LIGHTING,false);
ITriangleSelector* selector=myscene->createTriangleSelector(mesh->getMesh(0),node);
    node->setTriangleSelector(selector);
    
    IMetaTriangleSelector* metaSelector=myscene->createMetaTriangleSelector();
    metaSelector->addTriangleSelector(selector);

 mesh =myscene->getMesh("cube.3DS");
    node=myscene->addAnimatedMeshSceneNode(mesh,0,CUBE);
    node->setPosition(vector3df(0,100,0));

 aabbox3d<f32> box_cube=node->getTransformedBoundingBox();
    vector3df ellipsoidRadius = box_cube.MaxEdge - box_cube.getCenter();

    ISceneNodeAnimatorCollisionResponse* anim =
        myscene->createCollisionResponseAnimator(
		    metaSelector, //triangle selector della mappa
            node
          ,ellipsoidRadius
          ,vector3df(0,-0.01,0)
          ,vector3df(0,0,0)
          );             

    node->addAnimator(anim);
	anim->drop(); 

When I set the position of my element(cube) before the creation of Animator, the element stops before the collision, I don't know why , I have show the Bounding box and appears correct, but my element doesn't collide with the floor.

why ??

If I change the position after the creation of animator, collision appears right but my element is stuck in to the ground and i cannot change his position.

thanks
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You're using a collision response animator which doesn't use the bounding box of the node but the ellipsoid that you pass in, so presumably your ellipsoid isn't correct for your node.
Image Image Image
Post Reply