[SOLVED] remove the collision?

r1cky17

16-10-2007 08:19:03

hi, i have a problem in removing the collision.
i make racing game, and for the 1st stage i add a collision to all object in the 1st stage.
this is the code that i use to add the collision

SceneNode* bodyNode = mSceneMgr->getSceneNode(bodyName);
Vector3 currPos = bodyNode->getPosition();
Quaternion currOrient = bodyNode->getOrientation();

OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, bodyNode, false );
OgreNewt::Body* bod = new OgreNewt::Body( m_World, col );
delete col;

bod->attachToNode(bodyNode);
bod->setPositionOrientation(currPos, currOrient);


and if i change the stage, the object collision from the old stage is not gone.
am i need to destroy the collision for all objects in the old stage?
how to destroy the collision?

thx for the help

walaber

16-10-2007 18:19:33

easy way:

1. delete the old body from the old level.
2. make a new body from the new level.



another way:
1. build a new collision object from the new level.
2. set the collision for the body with setCollision().
3. delete the old collision object.

r1cky17

18-10-2007 07:35:09

thx for the way to do remove the collision.
but i don't know to do that in the program.
can you give me code to delete the collssion?
b'coz i don't know how to delete that from the program.
i have try to delete that but it's not work at all

r1cky17

11-11-2007 19:31:38

i can delete the body right now :D
just see this http://www.ogre3d.org/phpBB2addons/view ... 2156#32156