World:newMeshCollider
EditAdds a Collider to the world and attaches a MeshShape.
Colliders with mesh shapes are immobile and can only be used for static environment objects. The collider will be kinematic and forces/velocities will not move it. Also, these colliders will not detect collisions with other kinematic objects.
MeshShapes are not treated as solid objects, but instead a collection of triangles. They do not have mass or volume, and there is no concept of being "inside" a mesh. ConvexShape is a good alternative for making solid objects.
Arguments
| Name | Type | Description |
| vertices | table | A table of vertices in the mesh. Can be a table of tables (each with 3 numbers) or a table of numbers (every 3 numbers form a 3D vertex). |
| indices | table | A table of triangle indices representing how the vertices are connected together into triangles. |
Returns
| Name | Type | Description |
| collider | Collider | The new Collider. |
Arguments
| Name | Type | Description |
| modelData | ModelData | A ModelData to use for the mesh data. |
Returns
| Name | Type | Description |
| collider | Collider | The new Collider. |
Arguments
| Name | Type | Description |
| model | Model |
A Model to use for the mesh data. Similar to calling Model:getTriangles and passing it to this function, but has better performance.
|
Returns
| Name | Type | Description |
| collider | Collider | The new Collider. |
Arguments
| Name | Type | Description |
| mesh | Mesh |
A Mesh to use for the mesh data. It must use the cpu storage mode.
|
Returns
| Name | Type | Description |
| collider | Collider | The new Collider. |
Clones an existing MeshShape, which is faster than passing the same mesh multiple times. Clones can have their own scale. The clone's scale doesn't get multiplied with the scale of the template.
Arguments
| Name | Type | Description |
| template | MeshShape | An existing MeshShape to reuse. |
Returns
| Name | Type | Description |
| collider | Collider | The new Collider. |
Notes
The triangles in a MeshShape should use counterclockwise winding.