Offset Forward vector of object based on Rotation

Posted by Taylor on Game Development See other posts from Game Development or by Taylor
Published on 2012-09-13T00:20:19Z Indexed on 2012/09/13 3:51 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

I'm using the Bullet 3D physics engine in a iOS application running openGL ES 1.1

Currently I'm accepting info from the gyroscope to allow the user to "look around" a 3d world that follows a bouncing ball (note: it only takes in the yaw to look around 360 degrees). Im also accepting information from the accelerometer based on the tilt to push the ball. As of right now, to move forward, the user tilts the devise forward (using the accelerometer); to move to the right, the user tilts the devise to the right and so on. The forward vector is currently along it's local Z-axis.

The problem is that I want to change the ball bounce based on where the user has changed the view. If I change the view, the ball bounces in the fixed direction.

I want to change the forward facing direction so that when a user changes the view (say to the look at the right of the world, the user rotates the device), tilting the devise forward will result in a forward force in that direction.

Basically, I want the forward vector to take the rotation into consideration.

Sorry if I didn't explain the issue well enough, its kind of confusing to write down.

© Game Development or respective owner

Related posts about opengl

Related posts about opengl-es