Skip to main content
added 639 characters in body
Source Link

This should be similar to all movement in that it can be described by location, a point, and velocity, a vector. It is reasonable to assume that the flight takes a predetermined amount of time in seconds or ticks. You can calculate the velocity based on the distance and time of flight. Unfortunately this exchange does not have latex implemented so this might look a bit rough.

Plane is to travel a distance d in a given number of seconds t from point p1 to point p2 where d = \sqrt( (p2_x - p1_x)^2 + (p2_y - p1_y)^2 ).

Let us define the number of seconds per tick as q, then the number of ticks required for the flight is c = t/q.

Now we need to determine the velocity vector v, we want the slope from p1 to p2, and the magnitude from distance divided by the flight time.

First we create a unit vector pointing from p1 to p2. u = \frac{1}{d} (p2 - p1)

Then we scale the unit vector by d/c. v = \frac{d}{c} u

The planes position at any given tick (during the flight) is p = p1 + number_of_ticks_in_air * v

This should be similar to all movement in that it can be described by location, a point, and velocity, a vector. It is reasonable to assume that the flight takes a predetermined amount of time in seconds or ticks. You can calculate the velocity based on the distance and time of flight.

This should be similar to all movement in that it can be described by location, a point, and velocity, a vector. It is reasonable to assume that the flight takes a predetermined amount of time in seconds or ticks. You can calculate the velocity based on the distance and time of flight. Unfortunately this exchange does not have latex implemented so this might look a bit rough.

Plane is to travel a distance d in a given number of seconds t from point p1 to point p2 where d = \sqrt( (p2_x - p1_x)^2 + (p2_y - p1_y)^2 ).

Let us define the number of seconds per tick as q, then the number of ticks required for the flight is c = t/q.

Now we need to determine the velocity vector v, we want the slope from p1 to p2, and the magnitude from distance divided by the flight time.

First we create a unit vector pointing from p1 to p2. u = \frac{1}{d} (p2 - p1)

Then we scale the unit vector by d/c. v = \frac{d}{c} u

The planes position at any given tick (during the flight) is p = p1 + number_of_ticks_in_air * v

Source Link

This should be similar to all movement in that it can be described by location, a point, and velocity, a vector. It is reasonable to assume that the flight takes a predetermined amount of time in seconds or ticks. You can calculate the velocity based on the distance and time of flight.