Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you stop OgreBullet Capsule from falling over?
    primarykey
    data
    text
    <p>I've just started implementing bullet into my Ogre project. I follows the install instructions here: <a href="http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1" rel="nofollow">http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1</a></p> <p>And the rest if the tutorial here: <a href="http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2" rel="nofollow">http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2</a></p> <p>I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around.</p> <p>I need a way to fix the capsule to always stay upright, but I have no idea how</p> <p>Below is the code I'm using.</p> <p>(part of) Header File</p> <pre><code>OgreBulletDynamics::DynamicsWorld *mWorld; // OgreBullet World OgreBulletCollisions::DebugDrawer *debugDrawer; std::deque&lt;OgreBulletDynamics::RigidBody *&gt; mBodies; std::deque&lt;OgreBulletCollisions::CollisionShape *&gt; mShapes; OgreBulletCollisions::CollisionShape *character; OgreBulletDynamics::RigidBody *characterBody; Ogre::SceneNode *charNode; Ogre::Camera* mCamera; Ogre::SceneManager* mSceneMgr; Ogre::RenderWindow* mWindow; </code></pre> <p>main file</p> <pre><code>bool MinimalOgre::go(void) { ... mCamera = mSceneMgr-&gt;createCamera("PlayerCam"); mCamera-&gt;setPosition(Vector3(0,0,0)); mCamera-&gt;lookAt(Vector3(0,0,300)); mCamera-&gt;setNearClipDistance(5); mCameraMan = new OgreBites::SdkCameraMan(mCamera); OgreBulletCollisions::CollisionShape *Shape; Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance) OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody( "BasePlane", mWorld); defaultPlaneBody-&gt;setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction) // push the created objects to the deques mShapes.push_back(Shape); mBodies.push_back(defaultPlaneBody); character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0)); charNode = mSceneMgr-&gt;getRootSceneNode()-&gt;createChildSceneNode(); charNode-&gt;attachObject(mCamera); charNode-&gt;setPosition(mCamera-&gt;getPosition()); characterBody = new OgreBulletDynamics::RigidBody("character", mWorld); characterBody-&gt;setShape( charNode, character, 0.0f, // dynamic body restitution 10.0f, // dynamic body friction 10.0f, // dynamic bodymass Vector3(0,0,0), Quaternion(0, 0, 1, 0)); mShapes.push_back(character); mBodies.push_back(characterBody); ... } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload