Page 1 of 1

Top-down object movement

Posted: Sun Oct 14, 2012 7:10 am
by chadberk
If I was looking at a btRigidBody from top down and I wanted to have the movement be so that when I press forward it will always go in its forward direction, even after I turn it, how would I apply forward movement and rotation?

For direction it appears that I would use applyCentralForce, what what force? Is there a way to apply the forward direction as a force?
For rotation would it be as simple as just rotating the transform?

Re: Top-down object movement

Posted: Fri Oct 19, 2012 6:47 am
by chadberk
Am I missing any information that may provide assistance with my question?

Re: Top-down object movement

Posted: Thu Oct 25, 2012 6:03 am
by chadberk
Is there anyone that could help me with this?

Re: Top-down object movement

Posted: Thu Oct 25, 2012 6:14 am
by harrybro
what type of help you want.

Re: Top-down object movement

Posted: Thu Oct 25, 2012 6:25 am
by chadberk
harrybro wrote:what type of help you want.
With my original question, or if my original question is missing information, why information is it missing?

Re: Top-down object movement

Posted: Fri Oct 26, 2012 4:37 pm
by Erwin Coumans
The 'forward' direction you refer to is likely one of the local principal axis, such as the X, Y or Z axis.

You can use btVector3 localXdir = rigidbody->getWorldTransform().getBasis().getColumn(0); to get the local x axis,
use 1 or 2 for Y and Z.

Attached is a simple BasicDemo replacement, just unzip and copy the files over the existing demo in Bullet/Demos/BasicDemo and use the cursor keys to move around.
The sample is too simple to be practical, but it gives you an idea about movement.

Thanks,
Erwin