Page 1 of 1

collision problem

Posted: Thu Jan 31, 2008 11:10 am
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

Posted: Thu Jan 31, 2008 11:19 am
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.