View Single Post
Default   #8   Coda Coda is offline
Developer
Quote:
Originally Posted by Potironette View Post
Although, why isn't the
ball y = 10 m - (1/2)*g*t^2 and the
platform y = 0 + (1/2)*(15 m/s^2)*t^2 ?
Beeeeeeecause I remembered wrong. ^^() I was working from memory and I don't have to worry about that particular division when I'm working on game code because I'm fiddling with the constants ANYWAY until I find a result that feels playable. You're correct, and you should modify my examples appropriately.

Quote:
So..
If I put an extremely long ruler vertically up to the sky, y would be a point on the ruler, and that is why when the y of the ball and the y of the platform are equal, they hit each other?
Yes, exactly. y is measuring the positions of the objects from the perspective of an independent observer at rest.

Quote:
If I'm getting the bit about y being from the view of the outsider wrong, then everything that follows will be wrong :x

Ball: y = d - g*t^2
Platform: y = d, + a*t^2

(where d and d, are also points of the metaphorical ruler...or they are both according to the person on the platform's perspective.)

d - g*t^2 = d, + a*t^2
d - d, = a*t^2 + g*t^2
d - d, = ag(t^2)
(d - d,)/(ag) = t^2
sqrt((d - d,)/(ag)) = t

Ball: y = d - g*sqrt((d - d,)/(ag))
or
Platform: y = d, - a*sqrt((d - d,)/(ag))
((where the y is how high up the building the platform or ball is when they meet))

And, based on this... in order for the ball dropped to hit the platform at the location it fell from...

Ball: y = d - g*t^2
Platform: y = d, + a*t^2
y = d ? Or in
which means
Ball: d = d - g*t^2
0 = -g*t^2
meaning it's not possible for that to happen :o?
No, solving that last step for t results in t = 0, which means that given the initial conditions you put into the system, they start off in contact with each other.

Which is, in fact, what you did by using d in both of those position equations -- what you're calling d is the initial position of the object, and you've used the same position for both of them. You'll notice in my example that I had the ball starting at 10 and the platform starting at 0.

Quote:
And for the position of the ball you mean it's possible to find out the distance between the ball and the rising platform given a random time?
Yes, that's what I mean. You can determine that, as long as that time is between 0 and the point of contact. After the point of contact, those equations would be describing what would happen if they hadn't actually hit each other (for example if they passed through each other or if the ball was dropped BESIDE the platform instead of OVER it).

Quote:
d - d, = at^2 - gt^2 - vt
--I have no clue how to solve for t, but I can see it's possible!--
First, let's fix the problem with the two objects starting in the same place by calling the ball d and the platform e, and putting the missing 1/2 in.

To solve it, first you'd simplify:
d - e = (1/2)(a - g)t^2 - vt

Then you want to get 0 on the left:
0 = (1/2)(a - g)t^2 - vt - d + e

Then since that's in the form 0 = ax^2 + bx + c, you'd use the quadratic equation:
x = (-b +/- sqrt(b^2 - 4ac)) / (2a)

Substituting in the stuff from the equation, then that's:
t = (v +/- sqrt(v^2 - 4*((a - g)/2)*(-d + e))) / (2*(a - g)/2)

It looks scary, but a, g, v, d, and e are all constants, so you can plug it into a calculator.

This will return two values for x (one when you use +, one when you use -) that are solutions to the equation.

Quote:
Makes me wonder if there's a difference between moving vertically and horizontally o_o
Nope, there's not. The only thing that makes motion "vertical" is that it's parallel to the direction of gravity. All you have to do is replace g with the acceleration due to gravity in the direction of motion; for horizontal motion, that means g is 0.
Games by Coda (updated 4/15/2024 - New game: Call of Aether)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 12-02-2016, 04:14 PM Reply With Quote