one_eddie
08-06-2007 18:13:57
i'v setup OgreNewt an ran it.
I'v got 2 simple meshes.
I set collisions by:
and
But this doesn't work. Robot is stuck in this corrner (he can't move). When I disable colision creation its ok (but he can walk trought walls).
Please give me any advice. Where's the mistake?
I'v got 2 simple meshes.
I set collisions by:
mRobotEntity = mSceneMgr->createEntity("MovingRobot", "robot.mesh");
mRobotNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
mRobotNode->attachObject(mRobotEntity);
OgreNewt::Collision* robotCollision =
new OgreNewt::CollisionPrimitives::Box(mWorld, mRobotEntity->getBoundingBox().getMaximum());
mRobotBody = new OgreNewt::Body( mWorld, robotCollision );
delete robotCollision;
mRobotBody->setMassMatrix( 10.0, OgreNewt::MomentOfInertia::CalcBoxSolid( 10.0, mRobotEntity->getBoundingBox().getMaximum() ) );
mRobotBody->attachToNode( mRobotNode );
and
Entity* entLabirynth = mSceneMgr->createEntity("Labirynth01", "labirynth.mesh");
mLabirynthNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
mLabirynthNode->attachObject(entLabirynth);
mLabirynthNode->setVisible(false);
mLabirynthNode->scale(1.0f, 0.5f, 1.0f);
OgreNewt::Collision* labCollision = new OgreNewt::CollisionPrimitives::TreeCollision(mWorld, mLabirynthNode, false);
OgreNewt::Body* body = new OgreNewt::Body( mWorld, labCollision );
delete labCollision;
body->attachToNode( mLabirynthNode );
But this doesn't work. Robot is stuck in this corrner (he can't move). When I disable colision creation its ok (but he can walk trought walls).
Please give me any advice. Where's the mistake?