Public Group

# Movement issues...

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

## 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 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

1. 1
2. 2
3. 3
Rutin
20
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633656
• Total Posts
3013186
×