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
| Types | Description |
|---|---|
cuboid | Box shape |
ball | Sphere shape |
capsule | Capsule shape |
cone | Cone shape |
cylinder | Cylinder shape |
convexHull | Compute the convex hull (shape) of the given set of points. |
trimesh | A set of indices indicating what vertex is used by what triangle. |
heightfield | Large rectangle in the X-Z plane, subdivided in a grid pattern at regular intervals |
Avoid using
trimesh with dynamic bodies, since the performance get compromisedRigid body
The real-time simulation of rigid-bodies subjected to forces and contacts is the main feature of a physics engine for video-games, robotics, or animation.
Custom colliders
Add custom colliders not tied to a 3D mesh to define precise collision shapes using cuboid, ball, capsule, hull, trimesh, and other built-in collider types.