Skip to content

Commit

Permalink
mention TriMeshFlags in documentation (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz authored Feb 2, 2025
1 parent 4bbed41 commit 7e6adea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/user_guides/templates/colliders.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,25 @@ A triangle mesh/polyline is composed of triangles/segments with no thickness. Th
point-containment tests won't work intuitively because the triangle mesh is assumed to have no interior.
:::

#### Triangle mesh

A **triangle-mesh** collider can be built
with <rapier>`ColliderBuilder::trimesh(vertices, indices)`</rapier><bevy>`Collider::trimesh(vertices, indices)`</bevy><js>`ColliderDesc.trimesh(vertices, indices)`</js> where
`vertices` is the buffer containing all the vertices of the mesh, and `indices` is a set of indices indicating what vertex is used by
what triangle. The vertex buffer and index buffer may have different lengths, and any vertex can be shared
by multiple triangles.

To have more control over the resulting `Trimesh`,
<rapier>you can call `ColliderBuilder::trimesh_with_flags(vertices, indices, trimesh_flags)`.</rapier>
<bevy>you can call `Collider::trimesh_with_flags(vertices, indices, trimesh_flags)`.</bevy>
<js>you can call `ColliderDesc.trimesh` with a third optional parameter `trimeshFlags`.</js>

For example, `TrimeshFlags::FIX_INTERNAL_EDGES` is a popular choice to help with correcting ghost collision.

See [`TriMeshFlags` documentation](https://docs.rs/rapier2d/latest/rapier2d/geometry/struct.TriMeshFlags.html) for more information.

#### Polyline

A **polyline** collider can be built
with <rapier>`ColliderBuilder::polyline(vertices, indices)`</rapier><bevy>`Collider::polyline(vertices, indices)`</bevy><js>`ColliderDesc.polyline(vertices, indices)`</js> where
`vertices` is the buffer containing all the vertices of the polyline, and `indices` is an optional set of indices
Expand Down

0 comments on commit 7e6adea

Please sign in to comment.