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?
Top-down object movement
Re: Top-down object movement
Am I missing any information that may provide assistance with my question?
Re: Top-down object movement
Is there anyone that could help me with this?
Re: Top-down object movement
what type of help you want.
Re: Top-down object movement
With my original question, or if my original question is missing information, why information is it missing?harrybro wrote:what type of help you want.
- Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
- Contact:
Re: Top-down object movement
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
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
- Attachments
-
- BasicDemo.zip
- (4.27 KiB) Downloaded 600 times