O'Reilly logo

The Essential Guide to Physics for Flash Games, Animation, and Simulations by Adrian Dobre, Dev Ramtal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A simple example

To see how all this works in practice, we will now look at a simple example. We'll set ourselves the task of simulating the motion of a ball thrown to the ground, using just a few lines of code.

To start with, let's try and picture the scenario that we are trying to model, the way it behaves in reality. Suppose you throw a volleyball in the air. How does it move? You've probably noticed that such a ball does not move in a straight line, but traces out a curved path. Moreover, the ball appears to move slowly at the top of the curve and quickly at the bottom, near the ground. When it hits the ground it usually bounces, but always reaches a lesser height than that from which it fell. Before we try to reproduce this motion, let us ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required