Rapier Physics Engine

website·Indexed 35 days ago

https://www.rapier.rs/docs/

A physics engine providing 2D and 3D simulations with support for f32 and f64 precision. The documentation covers the C API (version 0.36.0+c.0) and JavaScript bindings, detailing rigid bodies, colliders, joints, soft bodies, and character controllers.

Tokens
1.9M
Snippets
11.5K
Records
15.7K
Agent score
67%

What's inside Rapier

  1. Overview of Soft-Bodies in Rapier

    Soft-bodies (deformable bodies) are used for objects that bend, stretch, or squash, such as ropes, cloth, jelly, or balloons. Unlike rigid-bodies, which have a single moving frame, soft-bodies are composed of particles (mass points) that can move independently. They interact with the physics world through the following features:

    • Impulse Joints: Can be attached via soft frames to link soft-bodies to other soft-bodies, rigid-bodies, or multibodies.
    • Colliders: Both deformable and rigid colliders (including sensors) can be attached.
    • Skinning: A detailed mesh can follow the deformations of a coarser simulated lattice.
    • Kinematic Control: Specific parts of a soft-body can be controlled kinematically.
    • Plasticity and Tearing: Soft-bodies can support permanent deformation and tearing.
  2. Overview of rapier_math.h

    The rapier_math.h file provides inline value constructors and arithmetic operations. These operations are designed to perform no memory allocation and cause no error-state changes, making them suitable for high-performance physics calculations.
  3. Overview of Rapier soft-bodies

    Soft-bodies (deformable bodies) are used for objects that bend, stretch, or squash, such as ropes, cloth, jelly, and balloons. Unlike rigid-bodies, which have a single moving frame, soft-bodies are composed of particles (mass points) that can move independently. They interact with the physics world through several mechanisms:

    • Impulse Joints: Can be attached via soft frames to link soft-bodies to other soft-bodies, rigid-bodies, or multibodies.
    • Colliders: Both deformable and rigid colliders (including sensors) can be attached.
    • Skinning: High-detail meshes can follow the deformations of a coarser simulated lattice.
    • Kinematic Control: Specific parts of a soft-body can be controlled kinematically.
    • Plasticity and Tearing: Soft-bodies can support permanent deformation and tearing.

    Note: Rapier Python bindings are 3D only. Particles and elements are handled as NumPy arrays or sequences of tuples.

  4. Overview of Rapier Kinematic Character Controller

    The Kinematic Character Controller is a high-level tool designed to move kinematic bodies (which are immune to forces like gravity and impulses) while automatically accounting for obstacles. It implements the common 'move-and-slide' behavior, allowing characters or objects (like platforms) to stop at obstacles, slide on slopes, climb stairs, walk over small obstacles, and interact with moving platforms. It works by performing the necessary ray-casts and shape-casts to adjust a desired trajectory based on the scene's geometry.
  5. Overview of Rapier soft-bodies

    Soft-bodies (deformable bodies) are used for objects that bend, stretch, or squash, such as ropes, cloth, jelly, and balloons. They coexist with rigid-bodies and colliders in the physics world. Key capabilities include:

    • Attaching impulse joints via soft frames to link soft-bodies to other soft-bodies, rigid-bodies, or multibodies.
    • Attaching deformable or rigid colliders (including sensors).
    • Skinning: Using a detailed mesh that follows a coarser simulated lattice.
    • Kinematic control of specific parts of the body.
    • Support for plasticity (permanent deformation) and tearing.
  6. Overview of SphericalImpulseJoint

    The SphericalImpulseJoint class in @dimforge/rapier3d represents a joint that constrains two rigid bodies to a common point (a ball-and-socket joint), while allowing free rotation around that point. It inherits from ImpulseJoint.
  7. Overview of the Kinematic Character Controller

    The Kinematic Character Controller is a high-level tool used to move kinematic bodies (which are immune to forces like gravity and impulses) while automatically handling collision detection and trajectory adjustment. It implements the 'move-and-slide' operation, allowing characters to stop at obstacles, slide on slopes, climb stairs, and interact with moving platforms. It supports any Rapier shape, though cuboids, balls, and capsules are recommended for performance. Note that the controller only supports translation; rotational movement is not supported.
  8. Overview of Rapier C 2D f64 Shape Data Structures

    The Rapier C 2D f64 API provides several data structures for defining geometry and mesh data used in physics simulations. These structures handle shared immutable geometry and rendering data.
  9. Overview of Rapier C 3D f32 Joint Data Structures

    The Rapier C 3D f32 API provides several data structures for managing impulse joints and reduced-coordinate articulations. These structures handle joint configuration, limits, motors, and entity handles.
  10. Overview of the Rapier testbed

    The Rapier testbed is a physics sandbox based on the kiss3d renderer. It allows developers to quickly open a window, render a physics world, and use basic controls such as play/pause and mouse-based object grabbing. It is primarily used for prototyping scenes and reproducing issues. The testbed is available as the rapier_testbed2d and rapier_testbed3d crates.