Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 0 mass?
PostPosted: Thu Aug 25, 2011 8:49 pm 
Offline

Joined: Tue Jun 28, 2011 4:11 am
Posts: 14
Hello i am trying to set an object with 0 mass. my code looks like this

Code:

 btScalar characterHeight1=10.75;
     btScalar characterWidth1 =10.75;


    btConvexShape* capsule1 = new btCapsuleShape(characterWidth1,characterHeight1);


   
     myObject[0].mtrans2.setIdentity();

     myObject[0].mtrans2.setOrigin( btVector3( BtOgre::Convert::toBullet( Ogre::Vector3( 200,100,200) + Ogre::Vector3(0,60,0) ) ) );
     btScalar mass1(0);

    myMotionState1 = new MyMotionState(mtrans2, torsoNode);

     btRigidBody::btRigidBodyConstructionInfo rbInfo1(mass1,myMotionState1,capsule1,localInertia1);
     body5 = new btRigidBody(rbInfo1);

    body5->setAngularFactor(.0f);
    body5->setFriction(0.0f);
    //body5->setAngularVelocity( btVector3( 0.0f, 0.0f, 0.0f ) );
     body5->setActivationState (DISABLE_DEACTIVATION);
    SetMotionState3(body5);
   dynamicsWorld->addRigidBody(body5);
   dynamicsWorld2->addRigidBody( body5 );




It has very strange results. My only solution was to add this object to a new dynamics world and set the gravity to 0, but this is undesirable. This object is the turret on a tank in my game. I also used this code to have its turret always above the bottom of the tank.

Code:
    torsoTrans.setIdentity();

torsoTrans.setOrigin( btVector3(BtOgre::Convert::toBullet( position + Ogre::Vector3(0,60,0) )) );
 
    body5->setWorldTransform(torsoTrans);
    // body5->setCenterOfMassTransform(torsoTrans);
    body5->activate(true);


That code is updated every frame. I needed to have its gravity acceleration at 0 or mass at zero so that the turret is always sitting on top of the tank. The turret has shaky results, it doesn't look very good. Is there any other.

So these are two questions that are connected. any help with either thanks.


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: Google [Bot] and 2 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