Skip to content

Commit

Permalink
Merge pull request #122 from MineBill/collision-data
Browse files Browse the repository at this point in the history
Add some information about convex and triangle mesh collision data.
  • Loading branch information
mafiesto4 authored Dec 11, 2023
2 parents b6d72bf + d922fb7 commit 42be895
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions manual/physics/colliders/collision-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ Now open the asset (double-click on it) and assign the model to use for a collid
| **Convex Flags** | The convex mesh generation flags. See [ConvexMeshGenerationFlags](https://docs.flaxengine.com/api/FlaxEngine.ConvexMeshGenerationFlags.html) to learn more. |
| **Vertex Limit** | The convex mesh vertex limit. Use values in range [8;255]. |

### Collision data type
Flax allows you to generate a convex or a triangle mesh for your collision data.

#### Convex
A convex mesh is a simplified representation of a 3D object in which all internal angles are less than 180 degrees. This simplification results in a mesh with a uniform shape, and it's particularly well-suited for certain collision scenarios.

![Convex](media/convex.png)

#### Triangle mesh
A triangle mesh is a more detailed representation of a 3D object, consisting of interconnected triangles. This mesh type is capable of accurately representing complex and concave shapes, making it valuable for accurate collisions.

![Convex](media/triangle-mesh.png)

As you can see, a triangle mesh offers much more granularity and better represents the mesh but it comes at a cost:
- More expensive both in terms of memory and calculations.
- **Cannot** be used with a Rigidbody. This means they can only be used to collide against them.

## Create collision data from code

Flax supports creating most of the asset types in Editor using C# scripts (with editor plugins). The same applies to the collision data asset. Here is an example code that bakes the asset:
Expand Down
Binary file added manual/physics/colliders/media/convex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added manual/physics/colliders/media/triangle-mesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 42be895

Please sign in to comment.