Rapier logo

Automatic colliders

Automatically generated colliders that fit your mesh shape when a RigidBody is created, with support for cuboid, ball, capsule, and other preset shapes.

RigidBody comes with automatic colliders, if you need a custom Collider please check Custom Colliders, you can specify a set of pre-defined colliders in order to fit the mesh with the best shape possible. cuboid is the default.

A basic example, a ball falling down:

<template>
  <RigidBody collider="ball">
    <TresMesh :position="[0,7, 0]">
      <TresSphereGeometry />
      <TresMeshNormalMaterial />
    </TresMesh>
  </RigidBody>
</template>

Available Automatic Colliders

TypesDescription
cuboidBox shape
ballSphere shape
capsuleCapsule shape
coneCone shape
cylinderCylinder shape
convexHullCompute the convex hull (shape) of the given set of points.
trimeshA set of indices indicating what vertex is used by what triangle.
heightfieldLarge rectangle in the X-Z plane, subdivided in a grid pattern at regular intervals
Avoid using trimesh with dynamic bodies, since the performance get compromised