Open ch5_BouncingBalls.html in your HTML5-enabled Internet browser.
The orbiting camera is activated by default. Move the camera and you will see how all the objects adjust to the global transform (camera) and yet they keep bouncing according to its local transform (bouncing ball).
Let's explain here a little bit more in detail how we keep track of each ball.
First of all let's define some global variables and constants:
var ball = ; //Each element of this array is a ball
var BALL_GRAVITY = 9.8; //Earth acceleration 9.8 m/s2
var NUM_BALLS = 50; //Number of balls in this simulation
Next, we need to initialize the ball ...
With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.