Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Vibrating objects
PostPosted: Mon Jul 16, 2012 3:42 pm 
Offline

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

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:
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);
     entity->setCastShadows(shadow);
     if (mat != "") entity->setMaterialName(mat);
     SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
     node->attachObject(entity);
     node->scale(scale);
    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)
        vertices[i]*=scale;
    OgreBulletCollisions::CollisionShape *sceneShape =
                (OgreBulletCollisions::CollisionShape*)converter->createConvex();
     OgreBulletDynamics::RigidBody *defaultBody = new OgreBulletDynamics::RigidBody(name+"-rigidbody",mWorld);
     if (stat) {
         defaultBody->setStaticShape(node, sceneShape, restitution, friction, pos, q);
     } else {
        defaultBody->setShape(node,sceneShape,restitution,friction,mass,pos,q);
     }
}


Has anyone any idea what the problem is?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group