Arc Projectile Example

22
23
0
1

NOTE THAT THIS IS NOT ENTIRELY ACCURATE!! This game runs with the physics at 60 FPS. Therefore, adjustments may need to be made if you intend to use this feature. Also, this is a work in progress example. Not everything is set in stone, stuff are subject to change, there may be errors in the math, yada yada yada.


Use WASD to control Lucky. Use the Arrows to control Hope.

Press SPACEBAR to throw the ball. Either Lucky or Hope will throw the ball at the other, and hopefully one of the two will end up catching it.

Pres O to toggle visualizations (see where the characters are aiming for, the area in which the ball travels, etc.)

So how does this work? By nature, when we throw something upwards, it will travel in a parabolic shape. As the object flies further, gravity will begin to bring the object back towards the ground. Eventually the object will stop moving vertically, and then travel back down to the ground, increasing its velocity as it falls. This motion creates a parabola. Check it out yourself! Either use this game's simulation, or lob an object in the air to another person in real life and you'll see the parabola. It's just basic physics.

So what this game does is, when you prepare to throw the ball, the character will calculate the angle in which it needs to throw the ball in order for the ball to reach the other character while traveling in a parabola shape.


Once the angle has been determined, it's time to send that puppy flying!


KNOWN ISSUES:

There may be more issues that I am not aware of.

Editor