Browse Source

Rename collidables into colliders(SEO).
Finish Collider Shapes and Collidables.

Eideren 1 year ago
parent
commit
2c57d242ca

+ 0 - 102
en/manual/physics/collidables.md

@@ -1,102 +0,0 @@
-# Collidables
-
-<span class="badge text-bg-primary">Beginner</span>
-<span class="badge text-bg-success">Designer</span>
-
-To use physics in your project, add a **Collidables** component to an entity. 
-
-Collidables define the type of physics objects. There are three types:
-
-* [Static collidable](static-colliders.md): Objects that don't move (terrain, ..)
-* [Body collidable](rigid-bodies.md): Moving objects, affected by gravity and collisions or Kinematics
-* [Character collidable](characters.md): Colliders for basic characters (such as players, annimals, npcs, ..)
-
-You can also: 
-
-* Define the [shape of collidables components](colliders.md)
-* make [triggers](triggers.md), and detect when objects pass through them
-* constrict collider movement with [constraints](constraints.md)
-
-## How colliders interact 
-
-> [!WARNING]
-> TODO
-
-Colliders interact according to the table below.
-
-|   | Kinematic objects   | Kinematic triggers   | Rigidbody colliders   | Rigidbody triggers   | Static colliders        | Static triggers   
-|---|-------------|---------------------|-------------|---------------------|----------|------------------
-| Kinematic objects        | Collisions           | Collisions  | Collisions and dynamic| Collisions   | Collisions    | Collisions     
-| Kinematic triggers | Collisions           | Collisions   |Collisions           | Collisions     | Collisions     | Collisions   
-| Rigidbody colliders          | Collisions and dynamic     | Collisions     | Collisions and dynamic     | Collisions     | Collisions and dynamic| Collisions
-| Rigidbody triggers | Collisions         | Collisions  | Collisions | Collisions     | Collisions     | Collisions
-| Static colliders| Collisions| Collisions| Collisions and dynamic | Collisions   | Nothing   | Nothing
-|Static triggers     | Collisions     | Collisions     | Collisions     | Collisions    | Nothing    | Nothing
-
-* "Collisions" refers to collision information and events only. This means the collision is detected in the code, but the objects don't bump into each other (no dynamic response).
-
-* "Dynamic" means both collision information and events, plus dynamic response (ie the colliders bump into each other instead of passing through).
-
-For example, rigidbody colliders dynamically collide with static colliders (ie bump into them). However, no objects dynamically collide with triggers; collisions are detected in the code, but objects simply pass through.
-
-## Show colliders in the Scene Editor
-
-> [!WARNING]
-> TODO
-
-By default, colliders are invisible in the Scene Editor. To show them:
-
-1. In the Game Studio toolbar, in the top right, click the **Display gizmo options** icon.
-
-   ![Display gizmo options](media/display-gizmo-options.png)
-
-2. Select **Physics**.
-
-    ![Display physics option](media/display-physics-option.png)
-
-The Scene Editor displays collider shapes.
-
-![Display physics](media/display-physics.png)
-
-## Show colliders at runtime
-
-You can make colliders visible at runtime, which is useful for debugging problems with physics. To do this, use:
-
-``
-this.GetSimulation().ColliderShapesRendering = true;
-``
-
-> [!Note]
-> Collider shapes for infinite planes are always invisible.
-
-### Keyboard shortcut
-
-> [!WARNING]
-> TODO
-
-To show or hide collider shapes at runtime with a keyboard shortcut, use the **Debug physics shapes** script.
-
-1. In the **Asset View**, click **Add asset**.
-
-2. Select **Scripts** > **Debug physics shapes**.
-
-    ![Add debug physics shape script](media/add-debug-physics-shapes-script.png)
-
-3. In the Game Studio toolbar, click **Reload assemblies and update scripts**.
-
-    ![Reload assemblies](../platforms/media/reload-assemblies.png)
-
-4. Add the **Debug physics shapes** script as a component to an entity in the scene. It doesn't matter which entity.
-
-    ![Add debug physics shapes script component](media/add-debug-physics-shapes-component.png)
-
-The script binds the collider shape visibility to **Left Shift + Left Ctrl + P**, so you can turn it on and off at runtime. You can edit the script to bind a different key combination.
-
-## See also
-
-* [Configuration](configuration.md)
-* [Static collidable](static-colliders.md)
-* [Body collidable](rigid-bodies.md)
-* [Character collidable](characters.md)
-* [Colliders](colliders.md)
-* [Physics tutorials](tutorials.md)

+ 26 - 110
en/manual/physics/collider-shapes.md

@@ -1,140 +1,56 @@
-# Collider shapes
+# Collider Shapes
 
 <span class="badge text-bg-primary">Beginner</span>
 <span class="badge text-bg-success">Designer</span>
 
-For [colliders](colliders.md) to interact, you need to set their shape in the **Property Grid**. You can specify a geometric shape, or use a collider shape asset.
+Each [collidables](colliders.md) should have a collider defining its shape. You can set them through the **Property Grid**.
 
-![Select a collider shape](media/select-collider-shape.png)
+![Collider Types](media/collider-types.png)
 
-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.
+# Empty
 
-## Types of collider shape
+Empty do not collide with other objects, they are mostly used to anchor bodies with [constraints](constraints.md).
 
-### Box
+# Compound
 
-![Box](media/box.png)
+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 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.|
+![Select a collider shape](media/compound-types.png)
 
-### Capsule
+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.
 
-![Capsule](media/capsule.png)
+# Meshes
 
-The capsule shape is especially useful for character components, as its curved base lets the entity move to higher planes (eg when climbing staircases).
+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 |
-| -------------- |-------------| 
-| 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.|
+> [!WARNING]
+> Never use mesh colliders for body collidables, 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.
 
-### Cone
+# Convex Hulls
 
-![Cone](media/cone.png)
+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.
 
-| 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.|
+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.
 
-### Cylinder
+## Creating a Convex Hull
 
-![Cylinder](media/cylinder.png)
+1. In the Asset View pane, press the Add asset button, hover on the Physics-Bepu option and select Convex hull
 
-| 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.|
+   ![Adding a convex hull](media/convex-hull-add-asset.png)
 
-### Sphere
+   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.
 
-![Sphere](media/sphere.png)
+   You can now add this new hull to one of your collidable.
 
-| 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.|
+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.
 
-### Infinite plane
+3. Next to `Colliders`, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select `ConvexHullCollider`
 
-![Infinite plane](media/infinite-plane.png)
+   ![Adding a convex hull](media/convex-hull-add-to-component.png)
 
-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.
+4. Set the `Hull` property to your newly created hull by pressing on the hand icon
 
-| 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.
-
-    ![Create collider shape asset](media/create-collider-shape-asset.png)
-
-Game Studio creates the new collider shape asset in the **CollisionMeshes** folder.
-
-![Collider shape asset in Asset View](media/collider-shape-in-asset-view.png)
-
-### Create a collider shape asset from a model
-
-This is useful to quickly create a collider shape that matches a model.
-
-1. In the **Asset View** (bottom by default), click **Add asset**.
-
-2. Select **Physics** > **Convex hull**.
-
-    The **Select an asset** window opens.
-
-    ![Select model](media/select-model.png)
-
-3. Browse to the model asset you want to create a collider shape asset from and click **OK**.
-
-Game Studio creates a collider shape asset from the model.
-
-## Use a collider shape asset
-
-1. Under the **static collider** or **rigidbody** properties, under **Collider Shapes**, select **Asset**. 
-
-    ![Select collider shape asset](media/select-asset-collider-shape.png)
-
-2. Next to **Shape**, specify the collider shape asset you want to use.
-
-    ![Select collider shape asset](media/select-collider-shape-asset.png)
-
-    To do this, drag the asset from the **Asset View** to the **Shape** field in the Property Grid. Alternatively, click ![Hand icon](~/manual/game-studio/media/hand-icon.png) (**Select an asset**) and browse to the asset.
+   ![Setting the property](media/convex-hull-set-hull.png)
 
 ## See also
 

+ 39 - 29
en/manual/physics/colliders.md

@@ -1,58 +1,68 @@
-# Colliders
+# Collidables
 
 <span class="badge text-bg-primary">Beginner</span>
 <span class="badge text-bg-success">Designer</span>
 
-Each [collidables](colliders.md) should have a collider defining its shape. You can set them through the **Property Grid**.
+Collidables are the base entity components for physics objects. There are three types:
 
-![Collider Types](media/collider-types.png)
+* [Statics](static-colliders.md): Objects that don't move (terrain, ...)
+* [Bodies](rigid-bodies.md): Moving objects, affected by gravity and collisions or Kinematics
+* [Characters](characters.md): Colliders for basic characters (such as players, animals, npcs, ...)
 
-# Empty
+You can also:
 
-Empty do not collide with other objects, they are mostly used to anchor bodies with [constraints](constraints.md).
+* Define the [shape of collidables components](collider-shapes.md)
+* Make [triggers](triggers.md), and detect when other physics objects pass through them
+* Constrain collider movement with [constraints](constraints.md)
 
-# Compound
+## Collisions
 
-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.
+Collidables interact according to the table below.
 
-![Select a collider shape](media/compound-types.png)
+|            | Characters           | Bodies               | Statics              |
+|------------|----------------------|----------------------|----------------------|
+| Characters | Collides             | Collides and bounces | Collides             |
+| Bodies     | Collides and bounces | Collides and bounces | Collides and bounces |
+| Statics    | Collides             | Collides and bounces | Pass through         |
 
-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.
+Characters do not have any inertia, and so cannot bounce off of bodies or statics when colliding with them.
 
-# Meshes
+Three other factor control whether two collidables would collide with each other, their `Collision Layer`, `Collision Group` and their `Contact Event Handler`
 
-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.
+## Collision Layers
 
-> [!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.
+The collision layer controls whether that object would collide with object on other layers.
 
-# Convex Hulls
+This relationship is controlled through the [Simulation's Collision Matrix](simulation.md).
 
-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.
+## Collision Group
 
-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.
+This property is used to filter collisions inside a group of object, when two or more objects must share the same `Collision Layer`, but should not collide between each other.
 
-## Creating a Convex Hull
+It allows objects sharing the same `CollisionGroup.Id` to pass through each other when the absolute difference between their `IndexA`,`IndexB`, and `IndexC` is less than two.
 
-1. In the Asset View pane, press the Add asset button, hover on the Physics-Bepu option and select Convex hull
+Its utility is best shown through concrete examples.
 
-   ![Adding a convex hull](media/convex-hull-add-asset.png)
+- You have multiple characters `A, B, C, D` all set to the same `CollisionLayer`, they are split in two teams `A, B` and `C, D`. Members of the same team must not collide between each other, you can set `A, B`'s Id to 1 and `C, D`'s Id to 2.
 
-   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.
+- You have a chain of three colliders attached to each other `A, B, C`, you don't want A and C to collide with B, but A and C should collide together.
+Set A, B and C's Ids to 1 to start filtering, leave A's `IndexA` at 0, B's to 1 and C to 2.
+A and C will collide since the difference between their `IndexA` is equal to two,
+but neither of them will collide with B since they are both only one away from B's `IndexA` value.
 
-   You can now add this new hull to one of your collidable.
+## Contact Event Handler
 
-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.
+The contact event handler is a class that receives collision data whenever the object it is associated with collides with the world.
 
-3. Next to `Colliders`, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select `ConvexHullCollider`
+It is most often used to transform physics object into 'trigger boxes', areas that run events whenever objects, like the player character, passes through them. See [Triggers](triggers.md).
 
-   ![Adding a convex hull](media/convex-hull-add-to-component.png)
-
-4. Set the `Hull` property to your newly created hull by pressing on the hand icon
-   ![Setting the property](media/convex-hull-set-hull.png)
+If the contact event handler you bind to an object is set to `NoContactResponse`, the object will never collide with anything, it will only collect collision events.
 
 ## See also
 
+* [Configuration](configuration.md)
+* [Static](static-colliders.md)
+* [Body](rigid-bodies.md)
+* [Character](characters.md)
 * [Colliders](colliders.md)
-* [Tutorial: Create a bouncing ball](create-a-bouncing-ball.md)
-* [Tutorial: Script a trigger](script-a-trigger.md)
+* [Physics tutorials](tutorials.md)

+ 2 - 8
en/manual/physics/configuration.md

@@ -35,13 +35,7 @@ You should now have something like that:
 
 ![Bepu configuration](media/Bepu-configuration.png)
 
-### Simulation Settings
-
-These settings control the rules and parameters your physics simulation run under, enabling customization and fine-tuning of the physics environment to suit your game's requirements.
-You may also create multiple simulations and distribute your physics object between them depending on your needs.
-
-Have a look at the [API](https://doc.stride3d.net/latest/en/api/index.html) for more detail on what each property does.
-
 ## See also
 
-* [index](index.md)
+* [Simulation](simulation.md)
+* [Index](index.md)

+ 8 - 9
en/manual/physics/index.md

@@ -10,20 +10,19 @@ This section explains how physics components work, how to add them to your proje
 
 ## In this section
 
-* [Configuration](configuration.md): Manage simulations and all global parameters
-* [Collidables](collidables.md): Let's define our object type
-    * [Static collidable](static-colliders.md): Objects that don't move (terrain, ..)
+* [Configuration](configuration.md): Setting up Bepu
+* [Simulation](simulation.md): Managing the simulations parameters
+* [Collidables](colliders.md): The physics objects in your game world
+    * [Static collidable](static-colliders.md): Objects that don't move (terrain, ...)
     * [Body collidable](rigid-bodies.md): Moving objects, affected by gravity and collisions or Kinematics
-    * [Character collidable](characters.md): Colliders for basic characters (such as players, annimals, npcs, ..)
-    * [Colliders](colliders.md): Define the geometric shape of yours collidable components
-    * [Triggers](triggers.md): Use triggers to detect passing objects
-    * [Constraints](constraints.md): Create appealing and realistic physics
+    * [Character collidable](characters.md): Colliders for basic characters (such as players, animals, npcs, ...)
+* [Collider Shapes](collider-shapes.md): Define the geometric shape of yours collidable components
+* [Constraints](constraints.md): Create appealing and realistic physics
+* [Triggers](triggers.md): Use triggers to detect passing objects
 * [Raycasting](raycasting.md): Trace intersecting objects
 
 > [!WARNING]
 > Pages to redirect or recycle
-* [Simulation](simulation.md): How Stride controls physics
-* [Collider Shapes](collider-shapes.md): How Stride controls physics
 * [Kinematic Rigid Bodies](kinematic-rigid-bodies.md): How Stride controls physics
 
 ### Tutorials

+ 9 - 14
en/manual/physics/simulation.md

@@ -3,26 +3,21 @@
 <span class="badge text-bg-primary">Intermediate</span>
 <span class="badge text-bg-success">Programmer</span>
 
-Stride's physics are controlled by the [Simulation](xref:Stride.Physics.Simulation) class.
-You can change how Stride initializes the [simulation](xref:Stride.Physics.Simulation) by modifying flags in [PhysicsSettings](xref:Stride.Physics.PhysicsSettings), accessed in the **GameSettings** asset properties.
+Stride's physics are controlled by the [Simulation](xref:Stride.BepuPhysics.BepuSimulation) class.
+You can change how Stride initializes the [Simulation](xref:Stride.BepuPhysics.BepuSimulation) by going to the [Configuration](configuration.md) section of your game's settings.
 
->[!Note]
->Your scene must have at least one [Collider](colliders.md) in order for Stride to initialize the [Simulation](xref:Stride.Physics.Simulation) instance.
+These settings control the rules and parameters your physics simulation run under, enabling customization and fine-tuning of the physics environment to suit your game's requirements.
+You may also create multiple simulations and distribute your physics object between them depending on your needs.
 
-![Physics Settings](media/simulation-physics-settings.png)
+Have a look at the [API](https://doc.stride3d.net/latest/en/api/index.html) for more detail on what each property does.
 
-* `CollisionsOnly` initializes the [Simulation](xref:Stride.Physics.Simulation) with collision detection turned on, but no other physics. Objects won't react to physical forces.
+## Collision Layers and the Collision Matrix
 
-* `ContinuousCollisionDetection` initializes the [Simulation](xref:Stride.Physics.Simulation) with continuous collision detection (CCD). CCD prevents fast-moving entities (such as bullets) erroneously passing through other entities.
+You can assign your physics object to specific collision layers, those layers can then be set to ignore objects assigned to other layers. 
 
-> [!Note] 
-> The ``SoftBodySupport``, ``MultiThreaded``, and ``UseHardwareWhenPossible`` flags are currently disabled.
+Those rules can be set by modifying the collision matrix at runtime, or through the `Layer[...]` fields in the editor.
 
-At runtime, you can change some [Simulation](xref:Stride.Physics.Simulation) parameters:
-
-* `Gravity` — the global gravity, in [world units](../game-studio/world-units.md) per second squared
-* `FixedTimeStep` — the length of a simulation timestep, in seconds
-* `MaxSubSteps` — the maximum number of fixed timesteps the engine takes per update
+For example, pressing `Change values...`  next to `Layer0` and un-ticking `Layer1` would cause all objects on `Layer0` to pass through objects on `Layer1`.
 
 ## See also
 * [Colliders](colliders.md)