Help with applyForce and applyTorque

Psamathos
Posts: 1
Joined: Mon Mar 10, 2008 8:32 pm

Help with applyForce and applyTorque

Post by Psamathos »

Hi,

I'm new to Bullet and physics simulations in general. My problem is how to correctly use applyForce, I have a box ( 3x0.5x1 ) and want to push it with a force on only one axis - to simulate something like an engine.

I've tried alot of different things, like

Code: Select all

1) body->applyForce(btVector3(100, 0, 0), btVector3(1.5, 0, 0));
2) body->applyForce(btVector3(100, 0, 0), btVector3(0, 0, 0));
3) body->applyForce(body->getCenterOfMassTransform() * btVector(100, 0, 0), btVector(1.5, 0, 0));
version 3 seems to be best but the box still tends to "slide" around, which I don't think it should if I push along one axis.

Basicly the same thing applies to applyTorque, the version I'm using now is just

Code: Select all

body->applyTorque(btVector3(0, 20, 0));
but it seems somewhat unstable and one time by box just took of the ground and spun out of view.

I've set the linear dampening to 0.2 and angular dampening to 0.4 to stop the sliding, but that may not be optimal :)