|
|
@@ -3,143 +3,53 @@
|
|
|
<span class="badge text-bg-primary">Beginner</span>
|
|
|
<span class="badge text-bg-success">Designer</span>
|
|
|
|
|
|
-> [!WARNING]
|
|
|
-TODO
|
|
|
-
|
|
|
-Each [collidables](colliders.md) must have a collider, That will define it's shape. You can do so in the **Property Grid**.
|
|
|
-You can specify a geometric shape, or use a collider shape asset.
|
|
|
-By default, it's an EmptyCollider wich can be considered like a ghost. It can be usefull with static collidables to anchor things.
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-Components can have multiple intersecting shapes, and don't have to match the entity model, if it has one. Each shape has additional properties including size, orientation, offset, and so on.
|
|
|
-
|
|
|
-## Types of collider shape
|
|
|
-
|
|
|
-### Box
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-| Property | Description |
|
|
|
-| -------------- |-------------|
|
|
|
-| Is 2D | Makes the box infinitely flat in one dimension. |
|
|
|
-| Size | The box size in XYZ values. |
|
|
|
-| Local offset | The box position relative its entity.|
|
|
|
-| Local rotation | The box rotation in XYZ values.|
|
|
|
-
|
|
|
-### Capsule
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-The capsule shape is especially useful for character components, as its curved base lets the entity move to higher planes (eg when climbing staircases).
|
|
|
-
|
|
|
-| Property | Description |
|
|
|
-| -------------- |-------------|
|
|
|
-| Is 2D | Makes the capsule infinitely flat in one dimension.|
|
|
|
-| Length | The length of the capsule.|
|
|
|
-| Radius | The radius of the capsule.|
|
|
|
-| Orientation | The axis along which the shape is stretched (X, Y, or Z).|
|
|
|
-| Local offset | The capsule position relative to its entity.|
|
|
|
-| Local rotation | The capsule rotation in XYZ values.|
|
|
|
-
|
|
|
-### Cone
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-| Property | Description |
|
|
|
-| -------------- |-------------|
|
|
|
-| Height | The height of the cone.|
|
|
|
-| Radius | The radius of the cone at the bottom end.|
|
|
|
-| Orientation | The axis along which the shape is stretched (X, Y, or Z).|
|
|
|
-| Local offset | The cone position relative to its entity.|
|
|
|
-| Local rotation | The cone rotation in XYZ values.|
|
|
|
+Each [collidables](colliders.md) should have a collider defining its shape. You can set them through the **Property Grid**.
|
|
|
|
|
|
-### Cylinder
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+# Empty
|
|
|
|
|
|
-| Property | Description |
|
|
|
-| -------------- |-------------|
|
|
|
-| Height | The length of the cylinder.|
|
|
|
-| Radius | The radius of the cylinder.|
|
|
|
-| Orientation | Sets the axis along which the shape is stretched (X, Y, or Z).|
|
|
|
-| Local offset | The cylinder position relative to its entity.|
|
|
|
-| Local rotation | The cylinder rotation in XYZ values.|
|
|
|
+Empty do not collide with other objects, they are mostly used to anchor bodies with [constraints](constraints.md).
|
|
|
|
|
|
-### Sphere
|
|
|
+# Compound
|
|
|
|
|
|
-
|
|
|
+A compound collider is a shape made up of a bunch of more primitive shapes, most of these are self-explanatory, while `Convex Hull` has a section describing it in more detail below.
|
|
|
|
|
|
-| Property | Description |
|
|
|
-| -------------- |-------------|
|
|
|
-| Is 2D | Makes the sphere infinitely flat in one dimension. |
|
|
|
-| Radius | The radius of the sphere.|
|
|
|
-| Local offset | The sphere position relative to its entity.|
|
|
|
+
|
|
|
|
|
|
-### Infinite plane
|
|
|
+Those individual primitives can intersect between each other, and don't necessarily have to match the model they are attached to. Each shape has additional properties including size, orientation, offset, and so on.
|
|
|
|
|
|
-
|
|
|
+# Meshes
|
|
|
|
|
|
-The infinite plane covers an infinite distance across one dimension.
|
|
|
-Think of it like a wall or floor stretching into the distance for ever.
|
|
|
-You can use several infinite planes together to box users in and stop them "tunneling" outside the level.
|
|
|
+Mesh colliders use 3D models as the collision shape itself. They are significantly slower than compounds, use them only when building a compound collider would be counter-productive.
|
|
|
|
|
|
-| Property | Description |
|
|
|
-| -------------- |-------------|
|
|
|
-| Normal | Which vector (X, Y, or Z) is perpendicular to the plane. For example, to make an infinite floor, set the normal property to: _X:0, Y:1, Z:0_. |
|
|
|
-| Offset | The plane position relative to its entity.|
|
|
|
-
|
|
|
-### Asset
|
|
|
-
|
|
|
-Assigns a collider shape from a collider shape asset (see **Collider shape assets** below).
|
|
|
-
|
|
|
-| Property | Description |
|
|
|
-| -------------- |-------------|
|
|
|
-| Shape | The collider shape asset used to generate the collider shape.|
|
|
|
-
|
|
|
-## Collider shape assets
|
|
|
-
|
|
|
-You can also create **collider shape assets** and use them as your collider shape. This means you can edit the collider shape asset and automatically update it in every entity that uses it.
|
|
|
-
|
|
|
-## Create a collider shape asset
|
|
|
-
|
|
|
-1. In the **Asset View** (bottom by default), click **Add asset**.
|
|
|
-
|
|
|
-2. Select **Physics**, then select the shape you want to create.
|
|
|
-
|
|
|
- 
|
|
|
-
|
|
|
-Game Studio creates the new collider shape asset in the **CollisionMeshes** folder.
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-### Create a collider shape asset from a model
|
|
|
-
|
|
|
-This is useful to quickly create a collider shape that matches a model.
|
|
|
+> [!WARNING]
|
|
|
+> Never use mesh colliders for your bodies, use them only for statics, they are far too slow to be used as bodies. If you absolutely need a more complex shape than the primitive ones, use a convex hull instead.
|
|
|
|
|
|
-1. In the **Asset View** (bottom by default), click **Add asset**.
|
|
|
+# Convex Hulls
|
|
|
|
|
|
-2. Select **Physics** > **Convex hull**.
|
|
|
+A convex hull is a convex shape that envelopes another. For example, the convex hull of the Eiffel Tower would be a pyramid large enough to contain the entire tower without any bits poking through.
|
|
|
|
|
|
- The **Select an asset** window opens.
|
|
|
+Convex shapes are easier to test for collision, simulate and find intersections with, reducing the compute load physics engine have to deal with compared to their mesh counterpart.
|
|
|
|
|
|
- 
|
|
|
+## Creating a Convex Hull
|
|
|
|
|
|
-3. Browse to the model asset you want to create a collider shape asset from and click **OK**.
|
|
|
+1. In the Asset View pane, press the Add asset button, hover on the Physics-Bepu option and select Convex hull
|
|
|
|
|
|
-Game Studio creates a collider shape asset from the model.
|
|
|
+ 
|
|
|
|
|
|
-## Use a collider shape asset
|
|
|
+ A new window will open prompting you to select a model asset, select the asset you want to create this hull from and press Ok.
|
|
|
|
|
|
-1. Under the **static collider** or **rigidbody** properties, under **Collider Shapes**, select **Asset**.
|
|
|
+ You can now add this new hull to one of your collidable.
|
|
|
|
|
|
- 
|
|
|
+2. Select the entity you want to add this Convex Hull to, add in a collidable component as is described in the [static](static-colliders.md) or [body](rigid-bodies.md) section.
|
|
|
|
|
|
-2. Next to **Shape**, specify the collider shape asset you want to use.
|
|
|
+3. Next to `Colliders`, click  (**Add**) and select `ConvexHullCollider`
|
|
|
|
|
|
- 
|
|
|
+ 
|
|
|
|
|
|
- To do this, drag the asset from the **Asset View** to the **Shape** field in the Property Grid. Alternatively, click  (**Select an asset**) and browse to the asset.
|
|
|
+4. Set the `Hull` property to your newly created hull by pressing on the hand icon
|
|
|
+ 
|
|
|
|
|
|
## See also
|
|
|
|