Sign in to follow this  

Movement issues...

This topic is 4731 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im working on a game where I need to 'fly'. I know this may be very basic knowledge, but everything Ive every done was only across 2 axes. I need to know how to use all three axes in movement. Right now, Ive been working using examples from a book that use 2 axes, with the code basically laid out like so: case FORWARD: pos.x = pos.x + ((abs(facing.x/90) * sin(D3DXToRadian(facing.x)))/10); pos.y = pos.y + ((abs(facing.y/90) * sin(D3DXToRadian(facing.y)))/10); pos.z = pos.z + ((abs(facing.z) * sin(D3DXToRadian(facing.z)))/10); break; This seems to work a little, but there are problems. The object flies in a different direction than it should (ie. along the x axis, when it should go right, it goes left, but is looking right). The facing structure is just a degree of which it is facing (ie. -90 <= facing.x < 90 and so on) (You can currently only face forward) The problem is, I think the math is incorrect. Anyone know what Im doing wrong?

Share this post


Link to post
Share on other sites
just lay out what you are trying to do in a simple format before actually putting it into code.

i.e.

case forward
-take user's facing direction and then translate the object in that direction

Share this post


Link to post
Share on other sites

This topic is 4731 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this