Jump to content
  • Advertisement
Sign in to follow this  

Bullet Physics: Teleport to possition

This topic is 3842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using Bullet Physics to handle things in my engine. first let me explain the goal I'm trying to achieve: I have a bunch of dynamic objects, but these objects can be "captured" by a non-dynamic object. When they are captured I was planning on attaching them via a constraint, then as the non-dynamic object moves I want the dynamic one to be pulled around via the constraint. Then of course the object can be released which i do by destroying the constraint. Any Bullet users out there that can tell me if that sounds like a sane wait of doing things? Now the part I'm currently having a problem with is moving the non-dynamic object, this is what I'm currently doing:
const VectorR3& pos = gameObj->getPosition();
const Rotation3D& rot = gameObj->getRotation();
btTransform trans;
trans.setOrigin( btVector3( pos.x(), pos.y(), pos.z() ) );
trans.setRotation( btQuaternion( btScalar( rot.x() ), btScalar( rot.y() ), btScalar( rot.z() ), btScalar( rot.w() ) ) );

btMotionState* motionState = physObj->body->getMotionState();
motionState->setWorldTransform( trans );
physObj->body->setCenterOfMassTransform( trans );

[Edited by - Wavesonics on June 4, 2008 8:52:00 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!