Skip to main content

rigid_body_locking_translations_rotations

It is sometimes useful to prevent a rigid-body from rotating or translating. One typical use-case for locking rotations is to prevent a player modeled as a dynamic rigid-body from tilting. These kind of degree-of-freedom restrictions could be achieved by joints, but locking translations/rotations of a single rigid-body wrt. the cartesian coordinate axes can be done in a much more efficient and numerically stable way. That's why rigid-bodies have dedicated methodsflagsmethods for this.

<load path='/2d/rust/examples/rs_rigid_bodies2.rs' marker='LockedAxes1' />
<load path='/2d/rust/examples/rs_rigid_bodies2.rs' marker='LockedAxes2' />
<load path='/2d/bevy/examples/rigid_bodies_continued2.rs' marker='LockedAxes1' />
<load path='/2d/bevy/examples/rigid_bodies_continued2.rs' marker='LockedAxes2' />
<load path='/2d/javascript/src/snippets/rigid_bodies.ts' marker='LockedAxes1' />
<load path='/2d/javascript/src/snippets/rigid_bodies.ts' marker='LockedAxes2' />