You are not logged in.
I'm making a game - I need to know the equation to use to calculate the x,y of where an object is located after a given amount of time. Here's what I know:
1- The object is traveling in a straight line at the same rate of travel
2- The object's start location (x,y)
3- The objects rate of travel
4- The time the object has been traveling and the time the object is supposed to arrive
5- The object's destination (x,y)
Any tips?
Thanks
Ryan
Offline
Parametric functions are useful when you want to find individual formulas for an object's x and y coordinates.
o_x: location in the x-axis at time t.
o_y: location in the y-axis at time t.
We know that o_x(0) = x and o_y(0) = y. We also know that o_x and o_y take on the following form:
o_x(t) = mt + b
o_y(t) = nt + c
Finally, we know the final destination, I will call it (w, z) at time s, when the object reaches it's destination:
o_x(s) = w
o_y(s) = z
So now we solve for m, b, n, and c.
o_x(0) = b = x
o_y(0) = c = y
So b = x and c = y. Now try solving for n and m, and you will find the objects position at time t expressed by:
(o_x(t), o_y(t))
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
Offline
Thanks for the post Ricky...
Wow, my math must be rusty.
Can we try this with some sample numbers?
Object started at (12,30) with a final destination of (-10,10). It will take a total of 10 minutes to get to the destination and has been traveling for 6 minutes so far.
Offline
Then we have the same equations:
o_x(t) = mt + b
o_y(t) = nt + c
As I said before:
o_x(t) = b = 12
o_y(t) = c = 30
So now we have:
o_x(t) = mt + 12
o_y(t) = nt + 30
Now we know that:
o_x(10) = -10
o_y(10) = 10
So we get:
-10 = o_x(10) = m*10 + 12
10 = o_y(10) = n*10 + 30
And solving this, we find:
m = -22 / 10 = -11/5
n = -20/10 = -2
So that our equations are:
o_x(t) = (-11/5)t + 12
o_y(t) = (-2)t + 30
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
Offline