Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention TriMeshFlags in documentation #131

Merged
merged 1 commit into from
Feb 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading