| New Reply |
Parabolic Motion |
Share Thread | Thread Tools |
| Jul13-12, 06:03 PM | #1 |
|
|
Parabolic Motion
I've been trying to make an online game using the rules of physics. If I'm not mistaken this flash game uses Newtonian physics by generating a vertical parabola to simulate gravity. I also realize that acceleration in the x direction can occur. Are there any other sort of kinematic principles I should take into account? Also I know that gravity on Earth is about 10. What is it for a typical game such as this? I guess it would be measured in pixels/sec^2. Any input is much appreciated.
Thanks so much |
| Jul13-12, 08:05 PM | #2 |
|
Recognitions:
|
Since you will need to generate the position at each point in the arc, you don't have to have exact solutions for the path of motion; you can simulate the differential equations. This means you can easily take into account air resistance, and maybe a wind blowing. The downside is there may be a small accumulation of error.
(Back in the early days of PCs, there was a free game written in Basic that involved gorillas throwing exploding bananas at each other across a city skyline. There was something weird about the trajectories, so I looked at the code. Horizontal wind had been implemented as some kind of lateral gravity, accelerating without limit!) |
| Jul14-12, 09:56 AM | #3 |
|
Mentor
|
|
| Jul14-12, 11:17 AM | #4 |
|
|
Parabolic Motion |
| Jul14-12, 01:28 PM | #5 |
|
Mentor
|
Calculate the second derivative: [itex]a=\frac{d^2y}{dt^2}=-10[/itex]
You can add all sorts of forces to this acceleration. Air resistance would be proportional to (v-vwind)^2 for reasonable velocities, for example. Now, for each time step, keep track of horizontal velocity v and position y. If the object jumps, set its initial velocity v0 to some value, corresponding to the "jumping capability" of the object. The position y0 is simply the location where the jump happens. Now, the iterative formulas can be written as: [itex]v_i=v_{i-1}+a_{i} dt[/itex] [itex]y_i=y_{i-1}+v_{i} dt[/itex] Those formula violate energy conservation, but they are a very simple way to calculate the position and velocity. The Runge–Kutta methods give a smaller error. |
| Jul15-12, 07:51 PM | #6 |
|
|
|
| Jul17-12, 06:11 AM | #7 |
|
Mentor
|
They violate energy conservation with finite time-steps. As an example, drop an object from a height of 30m with 0m/s initial velocity, and approximate g=10m/s^2. As time step, I use 1s (very large!). The pairs (velocity,position) are then given by:
(0,30) (10,30-10=20) (20,20-20=0) -> hits the floor with 20m/s. An object with mass 1kg would have an initial potential energy of mgh=300J, and a final kinetic energy of 1/2 mv^2 = 200J. The difference went in the bad approximations in the time steps. A better way to calculate the displacement would be to take the average of the old and the new velocity: [itex]y_i=y_{i-1}+\frac{v_i+v_{i-1}}{2}dt[/itex] Same situation again: (0,30) (10,25) (20,10) -> now, 20m/s corresponds to a drop of 20m, which is consistent with energy conservation. (30,-15) -> well, hit the floor somewhere in between. If the acceleration is not constant, this will lead to deviations again, but for constant acceleration it works. |
| Jul17-12, 06:55 AM | #8 |
|
|
|
| Jul17-12, 02:51 PM | #9 |
|
|
A recursive trajectory calculation is fairly easy to setup using the time gradiant and the acceleration of gravity. Depending on initial velocities and the drag coefficient of the object you can very accurately compute the path.
I did this for an external ballistics program in C back when DOS was the operating system of choice. I believe I still have it somewhere but right now everything is being packed up for our move to a new home. Paul |
| Jul17-12, 09:11 PM | #10 |
|
|
you probably got somebody who figured out you could plug x-y data in there computer game instead of math calculating equations.
the inverted parabola works for the sum of forces (x-y-z) throughout a fall with the opposite end of the foci representing the sum of horizontal forces exerted on the body at all times |
| Jul20-12, 09:06 PM | #11 |
|
|
|
| Jul21-12, 05:24 AM | #12 |
|
Mentor
|
In the limit dt->0, energy is conserved with all (reasonable) formulas, right.
|
| Jul23-12, 10:13 PM | #13 |
|
|
lol for using robot unicorn attack as an example of a game that uses parabolic motion. One question I have is how do you calculate the initial angle of the projectile? I think is the inverse tangent of initial velocity in the y direction divided by velocity in the x direction. How does acceleration affect the initial jump angle and the range of the projectile.
|
| New Reply |
| Thread Tools | |
Similar Threads for: Parabolic Motion
|
||||
| Thread | Forum | Replies | ||
| Horizontal / Vertical Motion, Parabolic Motion | Introductory Physics Homework | 5 | ||
| Parabolic Motion | Classical Physics | 15 | ||
| Parabolic Motion of a projectile | Introductory Physics Homework | 3 | ||
| Parabolic Motion | General Math | 3 | ||
| parabolic motion. air resistance? | Introductory Physics Homework | 19 | ||