Set a position.

Please don't post Bullet support questions here, use the above forums instead.
Glace
Posts: 2
Joined: Sat Jul 17, 2010 8:48 am

Set a position.

Post by Glace »

I've just been using translate() in the following manner:

Code: Select all

btTransform trans;
    body->getMotionState()->getWorldTransform(trans);
    body->translate(btVector3(newPosition - trans.getOrigin().getX(), 0, 0));
to set position.

This function stops doing anything after a little while, destroying and recreating the body fixs it.

How exactly are you meant to set a position?
Why is this happening?
Imago
Posts: 4
Joined: Sun Oct 10, 2010 6:13 am

Re: Set a position.

Post by Imago »

I have this same problem and would like to know as well.

Just started looking into Bullet, running off the HelloWorld tutorial so far.
Imago
Posts: 4
Joined: Sun Oct 10, 2010 6:13 am

Re: Set a position.

Post by Imago »

Getting closer. Found this on rigidBodies:

"Kinematic objects, which are objects without mass, but the user can move them. There is on-way interaction, and Bullet calculates a velocity based on the timestep and previous and current world transform. Bullet automatically deactivates dynamic rigid bodies, when the velocity is below a threshold for a given time. Deactivated (sleeping) rigid bodies don't take any processing time, except a minor broadphase collision detection impact (to allow active objects to activate/wake up sleeping objects)" - http://bulletphysics.com/Bullet/BulletFull/
Imago
Posts: 4
Joined: Sun Oct 10, 2010 6:13 am

Re: Set a position.

Post by Imago »

Found it. Here you go:


fallRigidBody->setActivationState(ACTIVE_TAG);
Imago
Posts: 4
Joined: Sun Oct 10, 2010 6:13 am

Re: Set a position.

Post by Imago »

One problem still.

If gravity is set too low (-47 or less) I can still change the position, but the gravitational pull stops.
Glace
Posts: 2
Joined: Sat Jul 17, 2010 8:48 am

Re: Set a position.

Post by Glace »

Imago wrote:Found it. Here you go:
fallRigidBody->setActivationState(ACTIVE_TAG);
Hmm, still didn't work for me. Just has the same result. At the moment I am recreating the body every time I wish to set the position. Let's hope this isn't too expensive doing many times.

Best of luck with your project.