O'Reilly logo

Game Development with Three.js by Isaac Sukin

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

Timing

As we start building more realistic examples, you'll notice delta parameters being passed around to functions that affect physics. Those deltas represent an amount of time since the last time physics was calculated, and they're used to smooth out movement over time.

The naive way to move objects in code is to simply change the object's position. For example, to move an object across the canvas, you might write obj.x += 10 inside your animation loop to move it 10 units every frame. This approach suffers from the issue that it is dependent on the frame rate. In other words, if your game is running slowly (that is, fewer frames per second), your object will also appear to move slowly, whereas if your game is running quickly (that is, more frames ...

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