O'Reilly logo

Learning Three.js: The JavaScript 3D Library for WebGL by Jos Dirksen

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

Using constraints to limit movement of objects

So far we've seen some basic physics in action. We've seen how the various shapes respond to gravity, friction, and restitution, and affect collisions. Physijs also provides advanced constructs that allow you to limit the movement of your objects. In Physijs these objects are called constraints. The following table gives an overview of the constraints that are available in Physijs:

Constraint

Description

PointConstraint

This constraint allows you to fix the position of one object to the position of another object. If one object moves, the other will move with it, keeping the distance and orientation between them the same.

HingeConstraint

The hinge constraint allows you to limit the movement ...

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