modifying Ragdoll to add robot

rockytriton

14-02-2009 02:13:25

Hi, I want to add the Ogre robot mesh to this. I don't need it to act like a ragdoll, I just want the model to fall onto the ground when I put it above ground like the zombie does.

at the bottom of the OgreNewtonFrameListener::OgreNewtonFrameListener() I put the following code:


mEntity = mSceneMgr->createEntity("Robot", "robot.mesh");
// Create the scene node
mNode = mSceneMgr->getRootSceneNode()->
createChildSceneNode("RobotNode", Vector3(0.0f, 3.0f, 0.0f));
mNode->attachObject(mEntity);
mNode->setScale(0.1f, 0.1f, 0.1f);


This adds the robot, but how to add add it to the world so that it will fall. It's positioned right where the zombie is now, a little above the ground, but it doesn't fall.

Zero23

15-02-2009 01:25:38

You need to create a OgreNewt::Collision and an OgreNewt::Bodyand attach your Noe to the Body. And call SetStandardForceCallback().

Zero

rockytriton

15-02-2009 05:09:48

I was thinking about that, but I'm not sure what to give as parameters when creating the Body. The samples I've seen using it give it info from some standard shapes like spheres and boxes, nothing from meshes.

Zero23

15-02-2009 15:05:24

Take a Ellipsoid, when you want to use your robot as character.

1. Create a Collision.
OgreNewt::Collision *col = new OgreNewt::CollisionPrimitives::Ellipsoid(you Physic World, Ogre::Vector3(size of your robot in x,y,z));

2. Create the Body.
OgreNewt::Body *bod = new OgreNewt::Body(your Physic World, col);
body->attachToNode(your robot node);