Vibrating objects

Post Reply
Posts: 1
Joined: Mon Jul 16, 2012 3:33 pm

Vibrating objects

Post by zalan » Mon Jul 16, 2012 3:42 pm


I am working on a program using OgreBullet and it needs some basic shapes. Most of the shapes work well, but the cylinder, convex, concave and convex decomposition behaves strangely. When they land they don't stop and switch to sleep mode, but start vibrating. I thing it's something to do with the inertia, because when I modify that, the vibration increases.

This is the code for the convex shape:

Code: Select all

void addConvexShape(OgreBulletDynamics::DynamicsWorld *mWorld, string name, string file, string mat, bool stat, bool shadow, Ogre::Vector3 pos, Ogre::Vector3 scale, Ogre::Quaternion q, float mass, float friction, float restitution, SceneManager* mSceneMgr)
     Entity *entity = mSceneMgr->createEntity(name,file);
     if (mat != "") entity->setMaterialName(mat);
     SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    OgreBulletCollisions::StaticMeshToShapeConverter *converter =
                new OgreBulletCollisions::StaticMeshToShapeConverter(entity);
    Ogre::Vector3 *vertices = (Ogre::Vector3*)converter->getVertices();
    int num = converter->getVertexCount();
    for (int i = 0; i < num; ++i)
    OgreBulletCollisions::CollisionShape *sceneShape =
     OgreBulletDynamics::RigidBody *defaultBody = new OgreBulletDynamics::RigidBody(name+"-rigidbody",mWorld);
     if (stat) {
         defaultBody->setStaticShape(node, sceneShape, restitution, friction, pos, q);
     } else {
Has anyone any idea what the problem is?

Post Reply