Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 30 July 2012 - 10:12 PM
Posted 31 July 2012 - 05:05 AM
Posted 31 July 2012 - 06:34 AM
Via a normalized 3D vector.Also, how should the heading/direction be stored?
Take the previous 3D vector, multiply it by the speed (not velocity) and by time, then add it to the ship’s current 3D vector that represents its position. The position of the ship has now moved in the correct direction by the correct amount.So put another way, given a ship at an arbitrary 3D point, (x, y, z), a heading/direction, a velocity and a time(delta), how do I find the point where the ship should end up?
Posted 04 August 2012 - 11:01 AM
This makes sense, I think. You're saying that I have one vector at my world origin which gives the ships x, y, z, and after adding the speed*direction*time to the position vector, it's the ship's new position.Take the previous 3D vector, multiply it by the speed (not velocity) and by time, then add it to the ship’s current 3D vector that represents its position. The position of the ship has now moved in the correct direction by the correct amount.
This I'm not so clear on. Is this unit vector centered about the world origin? I suppose it would be, right? If so, my difficulty now is in adjusting the direction of that unit vector. If the ship's "up" is in the positive Y direction, and the ship is facing the negative X, then when the user turns there ship to the left, I just rotate the facing direction about the Y axis, but I have trouble envisioning how it works when the "up" vector has X and Z components.You can use a unit vector to store your facing direction.
If you want to turn, rotate the vector.
Posted 06 August 2012 - 07:47 AM
It is a direction; it has no center point. This is like asking , “What is the center point of left?”.This I'm not so clear on. Is this unit vector centered about the world origin?
D + Rotated amount. To combine rotations, look into quaternions or matrix rotation around axes.When a user "turns" for time 't', (rotating only about the "up" axis, like turning on a flat road in a car), the ship rotates 'pi/10' radians in the direction turned.
If this ship turns for one time unit, what is its new direction vector?
P + D * 30.The ship's position in the world's reference frame is P=(50, 35, 35).
The ship moves 30 units in direction D before it turns, what is its new position P'?
D += PI/10 (Matrix Rotation Around U).Now the ship turns for one unit of time and rotates about U by pi/10.
The ship moves another 30 units in it's new direction D'.
Where is the ship's position P'' now?
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.