Browse Source

Tutorials

Eideren 1 year ago
parent
commit
981fcf961c
22 changed files with 167 additions and 210 deletions
  1. 37 53
      en/manual/physics/create-a-bouncing-ball.md
  2. 3 0
      en/manual/physics/media/bouncing-ball-with-trigger-no-effect.mp4
  3. 3 0
      en/manual/physics/media/bouncing-ball-with-trigger-scaled.mp4
  4. 3 0
      en/manual/physics/media/physics-tutorials-camera-preview.png
  5. 3 0
      en/manual/physics/media/physics-tutorials-create-a-bouncing-ball-falling-and-bouncing-ball.mp4
  6. 3 0
      en/manual/physics/media/physics-tutorials-create-a-bouncing-ball-falling-ball.mp4
  7. 3 0
      en/manual/physics/media/physics-tutorials-create-a-trigger-add-a-material-asset.png
  8. 3 0
      en/manual/physics/media/physics-tutorials-create-a-trigger-add-a-model-component.png
  9. 3 0
      en/manual/physics/media/physics-tutorials-create-a-trigger-add-a-model.png
  10. 3 0
      en/manual/physics/media/physics-tutorials-create-a-trigger-add-new-entity.png
  11. 3 0
      en/manual/physics/media/physics-tutorials-create-a-trigger-add-script-component-to-entity.png
  12. 3 0
      en/manual/physics/media/physics-tutorials-create-a-trigger-select-handler-component.png
  13. 3 0
      en/manual/physics/media/physics-tutorials-create-a-trigger-set-handler.png
  14. 3 0
      en/manual/physics/media/physics-tutorials-material-asset-picker.png
  15. 3 0
      en/manual/physics/media/physics-tutorials-pick-an-asset-up.png
  16. 3 0
      en/manual/physics/media/physics-tutorials-select-cube-model.png
  17. 3 0
      en/manual/physics/media/physics-tutorials-select-material-asset.png
  18. 3 0
      en/manual/physics/media/physics-tutorials-select-transparent-material.png
  19. 3 0
      en/manual/physics/media/physics-tutorials-set-blend-alpha.png
  20. 3 0
      en/manual/physics/media/physics-tutorials-set-blend.png
  21. 69 153
      en/manual/physics/script-a-trigger.md
  22. 4 4
      en/manual/physics/tutorials.md

+ 37 - 53
en/manual/physics/create-a-bouncing-ball.md

@@ -6,10 +6,7 @@
 <span class="badge text-bg-primary">Beginner</span>
 <span class="badge text-bg-success">Designer</span>
 
-In this tutorial, we'll use the [static collider and rigidbody components](colliders.md) to create a ball bouncing on a floor.
-
->[!Note]
->The screenshots and videos in this tutorial were made using an earlier version of Stride, so some parts of the UI, and the default skybox and sphere, might look different from your version.
+In this tutorial, we'll use the [static and body components](colliders.md) to create a ball bouncing on a floor.
 
 ## 1. Create a new project
 
@@ -17,51 +14,51 @@ Start a **New Game** project.
 
 The default scene comes pre-loaded with five entities: Camera, Directional light, Skybox, Ground, and Sphere. We're going to add physics components to the **Ground** and **Sphere** entities.
 
-## 2. Add a static collider
+## 2. Add a Static Component
    
-Let's begin by adding a [static collider](static-colliders.md) component to the Ground entity. A static collider is a physics object that doesn't move. Typical static colliders are walls, floors, large rocks, and so on. In this case, the static collider will give the ball something to bounce on.
+Let's begin by adding a [static collider](static-colliders.md) component to the Ground entity. A static component is a physics object that doesn't move. Typical static component are walls, floors, large rocks, and so on. In this case, the static component will give the ball something to bounce on.
 
 1. Select the **Ground** entity.
 
 2. In the **Property Grid**, click **Add component** and select **Static Collider**.
 
-    ![Add Static collider component](media/physics-tutorials-create-a-bouncing-ball-add-collider-component.png)
+    ![Add Static collider component](media/add-static-component.png)
 
-3. Set the [collider shape](collider-shapes.md) to match the shape of the entity. To do this, in the **Property Grid**, expand the **Static Collider component** to view its properties.
+3. Set the [collider shape](collider-shapes.md) to match the shape of the entity. To do this, in the **Property Grid**, expand the **Static Component** to view its properties.
 
-4. Next to **Collider Shapes**, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select **Infinite Plane**.
+4. Next to **Colliders**, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select **Box Collider**.
 
-    ![Add Static collider component](media/physics-tutorials-create-a-bouncing-ball-collider-shape.png)
+    ![Add Static collider component](media/compound-types.png)
 
     This adds a static collider to the ground, so the ball has something to bounce off.
 
-## 3. Add a rigidbody collider
+5. Set the `Size` property to `X: 10, Y: 0.1, Z: 10` to create a flat plane from this box
+
+## 3. Add a Body Component
 
-Next, we'll add a [rigidbody](rigid-bodies.md) component to the sphere. A rigidbody is a physics object that moves — perfect for our bouncing ball.
+Next, we'll add a [body](rigid-bodies.md) component to the sphere. A body is a physics object that moves — perfect for our bouncing ball.
 
 1. In the **Scene Editor**, select the **Sphere** entity.
 
 2. In the **Property Grid**, click **Add component** and select **Rigidbody**.
 
-    ![Add Static collider component](media/physics-tutorials-create-a-bouncing-ball-add-rigitbody-component.png)
+    ![Add Static collider component](media/add-body-component.png)
 
-3. Just like we did for the Ground entity, set the [collider shape](collider-shapes.md) to match the entity. To do this, in the **Property Grid**, expand the **Rigidbody component** to view its properties.
+3. Just like we did for the Ground entity, set the [collider shape](collider-shapes.md) to match the entity. To do this, in the **Property Grid**, expand the **Body Component** to view its properties.
 
-4. Next to **Collider Shapes**, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select **Sphere**.
+4. Next to **Colliders**, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select **Sphere**.
 
-     ![Add Static collider component](media/physics-tutorials-create-a-bouncing-ball-rigitbody-shape.png)
+     ![Add Static collider component](media/compound-types.png)
 
 ## 4. Position the ball
 
-Let's position the sphere so it starts in mid-air and falls to the ground.
+Let's position the sphere so it starts in midair and falls to the ground.
 
 1. Select the **Sphere** entity. 
 
-2. In the **Property Grid**, under **Transform**, set the **Position** to: _X: 0, Y: 6, Z: 0_
+2. In the **Property Grid**, under **Transform**, set the **Position** to: `X: 0, Y: 6, Z: 0`
 
-    ![Change Sphere position](media/physics-tutorials-create-a-bouncing-ball-change-sphere-position.png)
-
-    This places the ball in mid-air above the ground.
+    This places the ball in midair above the ground.
 
 ## 5. Position the camera
 
@@ -69,11 +66,7 @@ Now we'll move the camera to give us a good view of the scene.
 
 1. Select the **Camera** entity. 
 
-2. In the **Property Grid**, under **Transform**, set the **Position** to: _X: -12, Y: 7, Z: 9_
-
-3. Set the **Rotation** to: _X: -20, Y: -50, Z: 0_
-
-    ![Change camera position](media/physics-tutorials-create-a-bouncing-ball-change-camera-position.png)
+2. In the **Property Grid**, under **Transform**, set the **Position** to: `X: 11, Y: 3, Z: -4`
 
     You can see preview the camera view in the **Camera preview** in the bottom-right of the Scene Editor.
 
@@ -83,45 +76,36 @@ Now we'll move the camera to give us a good view of the scene.
 
 Let's see what the scene looks like so far. To run the project, press **F5**.
 
-![Falling ball](media/physics-tutorials-create-a-bouncing-ball-falling-ball.gif)
+<p>
+<video autoplay loop class="responsive-video">
+   <source src="media/physics-tutorials-create-a-bouncing-ball-falling-ball.mp4" type="video/mp4">
+</video>
+</p>
 
-The Sphere (rigidbody) responds to gravity and falls. The Ground (static collider) breaks its fall. But there's no bounce effect yet.
+The Sphere (body) responds to gravity and falls. The Ground (static collider) breaks its fall. But there's no bounce effect yet.
 
-To create a bounce effect, we need to change the **restitution** of the Sphere and the Ground. This simulates the [coefficient of restitution (Wikipedia)](https://en.wikipedia.org/wiki/Coefficient_of_restitution) of real-world collisions. 
+To create a bounce effect, we need to change the `Spring Frequency` and `Spring Daming Ratio` of the Sphere.
 
-* If the restitution property of colliding entities is 0, the entities lose all energy and stop moving immediately on impact. 
-* If the restitution is 1, they lose no energy and rebound with the same velocity at which they collided. 
-* If the restitution is higher than 1, they gain energy and rebound with *more* velocity. 
+> [!Note] Bepu internally uses speculative contacts which does not play well with traditional coefficient of restitution. Instead, bounces can be implemented through contact constraint springiness, this specificity mean that bounces actually take place over multiple simulation steps instead of on contact. This may be counter-intuitive for users accustomed to other engine's restitution-based bounciness.
 
-As a rule, to create realistic collisions, set the restitution between 0 and 1.
+* Bounciness is dominated by `Spring Damping Ratio`; setting it to zero minimizes energy loss on impact.
+* Increasing `Spring Frequency` can make impacts less bouncy when. This happens because the integration rate becomes too slow to represent the motion, and it gets damped away. Increasing the substepping rate or using more timesteps preserves bounciness with higher frequencies.
 
-Let's set the restitution of our Sphere and Ground entities.
+Let's set the `Spring Frequency` and `Spring Damping Ratio` of the Sphere.
 
 1. Select the **Sphere** entity.
 
-2. In the **Property Grid**, under **Rigidbody**, set the **Restitution** to 0.8.
-
-    ![Set restitution for a sphere](media/physics-tutorials-create-a-bouncing-ball-restitution-of-a-sphere.png)
-
-3. Select the **Ground** entity.
-
-4. In the **Property Grid**, under **Static Collider**, set the **Restitution** to 0.5.
-
-    ![Set restitution for the ground](media/physics-tutorials-create-a-bouncing-ball-restitution-of-the-ground.png)
+2. In the **Property Grid**, under **Body**, set the `Spring Frequency` to 3 and `Spring Damping Ratio` to 0.
 
 To see how this changes the physics, run the project again (**F5**). This time, the ball bounces on the ground before coming to a stop:
 
-![Bouncing effect](media/physics-tutorials-create-a-bouncing-ball-falling-and-bouncing-ball.gif)
-
-Try changing the restitution of both entities to 1. This creates a ball that bounces indefinitely, losing no energy:
-
-![Infinite bounce](media/physics-tutorials-create-a-bouncing-ball-infinitely-bouncing-ball.gif)
-
-Set the restitution to 1.1 and the ball bounces a little higher each time:
-
-![Ball bouncing higher](media/physics-tutorials-create-a-bouncing-ball-higher-and-higher.gif)
+<p>
+<video autoplay loop class="responsive-video">
+   <source src="media/physics-tutorials-create-a-bouncing-ball-falling-and-bouncing-ball.mp4" type="video/mp4">
+</video>
+</p>
 
-Now we've created a bouncing ball, we can use it to learn about triggers. For more information, see the [Script a trigger](script-a-trigger.md) tutorial.
+Now that we've created a bouncing ball, we can use it to learn to [Script a trigger](script-a-trigger.md).
 
 ## See also
 

+ 3 - 0
en/manual/physics/media/bouncing-ball-with-trigger-no-effect.mp4

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b0d408e3d3a9914281876f47588bb8a0f52ef1fe34993909f85d5da9ae6ad74d
+size 336966

+ 3 - 0
en/manual/physics/media/bouncing-ball-with-trigger-scaled.mp4

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0cbff7e0c399339d3b28a9257c44b7d6419812b0994824a69d511f2df64e48a5
+size 374149

+ 3 - 0
en/manual/physics/media/physics-tutorials-camera-preview.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:07a5615b1e785f8fb0b2b1bbc262d6834165b1b02a853e37da679df8d6eca9d0
+size 301016

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-bouncing-ball-falling-and-bouncing-ball.mp4

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:792aeccf14c9754794e094fe316991c5f7aca2b4e978d70ba2dbb67f65ec867b
+size 342817

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-bouncing-ball-falling-ball.mp4

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8512ababb31f181b3f569d599c560504d1cdf7b4f6c81fc721035855e14c202d
+size 219733

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-trigger-add-a-material-asset.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:30541281622ae2ee9c5d7da25fc37fea5eb802365c9950d46e1afdbfba7d7d3b
+size 36715

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-trigger-add-a-model-component.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:679988fa4d1fad17756b9bd76d181d517ca8228dab19e3280141518543663147
+size 21958

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-trigger-add-a-model.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:eff90302ff399ca580d8573f13a2476fbf6916cc68fa43a2a96183428a51a0e7
+size 30104

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-trigger-add-new-entity.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ed2185537c739b5d6c1c83fa6ebce91cf4509f8dfb6c14908bc9b134607fea23
+size 9728

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-trigger-add-script-component-to-entity.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7e3ab4b15fbbc4f5588f22e047ce7f20ac442d8d5cc4a8bacbe3ad05db9d1f58
+size 33158

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-trigger-select-handler-component.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9d8c9bf9bd396f5f76d52d19092af4c5a2325f137fa7008730818a2027aaf8c3
+size 18050

+ 3 - 0
en/manual/physics/media/physics-tutorials-create-a-trigger-set-handler.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2ec9618452d4fc28ee67c9588174bde9e49529a2e414539ebeeb3d33fc1a540b
+size 21756

+ 3 - 0
en/manual/physics/media/physics-tutorials-material-asset-picker.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6e811440cf1ec8f6a591e12bc5e91116a74f20294fb7b03a90d28eb6847f19c3
+size 21029

+ 3 - 0
en/manual/physics/media/physics-tutorials-pick-an-asset-up.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:66aa1d30de7a089d64b17fc0bc5f33b5e1b4a865727607dfc1b68da94f821358
+size 17168

+ 3 - 0
en/manual/physics/media/physics-tutorials-select-cube-model.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b351f06ec508eb6a95f6095abf9e66b649a125cd5f6cb19123b2d5f36ea5e53b
+size 39012

+ 3 - 0
en/manual/physics/media/physics-tutorials-select-material-asset.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a566d75ca7ff01386d69132e68565e73fe83e3baa0eaae1cede63774f9dc2fe0
+size 51603

+ 3 - 0
en/manual/physics/media/physics-tutorials-select-transparent-material.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:be367779afd73c73f0af066585047975ae1bc0a51ffbd6edc370da3973d99b0b
+size 39493

+ 3 - 0
en/manual/physics/media/physics-tutorials-set-blend-alpha.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5d683d6456f1b536e0c30661991c5541bcb23d57dd28aba1df18c9401bc14666
+size 8721

+ 3 - 0
en/manual/physics/media/physics-tutorials-set-blend.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1dc7a7d4575673a575827ec1067ad3a16e63ef477f3f5e5003121ab5cb3b7b17
+size 13813

+ 69 - 153
en/manual/physics/script-a-trigger.md

@@ -6,30 +6,14 @@
 > [!WARNING]
 > This page is outdated, the information contained therein are for Bullet, the previous physics engine
 
-In this tutorial, we'll create a [trigger](../physics/triggers.md) that doubles the size of a ball when the ball passes through it.
+In this tutorial, we'll create a [trigger](triggers.md) that doubles the size of a ball when the ball passes through it.
 
 >[!Note]
 >The screenshots and videos in this tutorial were made using an earlier version of Stride, so some parts of the UI, and the default skybox and sphere, might look different from your version.
 
 ## 1. Create a bouncing ball
 
-Follow the instructions in the [Create a bouncing ball](create-a-bouncing-ball.md) tutorial. This creates a simple scene in which a ball falls from mid-air, hits the ground, and bounces.
-
-## 2. Set the restitution
-
-For this tutorial, we'll set the restitution of both the ground and the sphere to 0.9, which makes the ball very bouncy. This makes it easier to see the effect of the trigger later, as the ball will bounce in and out of the trigger area repeatedly.
-
-1. Select the **Sphere** entity.
-
-2. In the **Property Grid**, under **Rigidbody**, set the **Restitution** to *0.9*.
-
-    ![Set restitution for a sphere](media/physics-tutorials-rigidbody-restitution.png)
-
-3. Select the **Ground** entity.
-
-4. In the **Property Grid**, under **Static Collider**, set the **Restitution** to *0.9*.
-
-    ![Set restitution for the ground](media/physics-tutorials-static-collider-restitution.png)
+Follow the instructions in the [Create a bouncing ball](create-a-bouncing-ball.md) tutorial. This creates a simple scene in which a ball falls from midair, hits the ground, and bounces.
 
 ## 3. Add a trigger 
 
@@ -43,33 +27,17 @@ Now we'll add a trigger between the ball and the ground, so the ball passes thro
 
 2. This entity will be our trigger, so rename it *Trigger* to make it easy to identify.
 
-3. Since we don't need the trigger to move, we'll make it a static collider. In the **Property Grid**, click **Add component** and select **Static Collider**.
-
-    ![Add Static collider component](media/physics-tutorials-create-a-bouncing-ball-add-collider-component.png)
-
-4. In the **Property Grid**, expand the **Static Collider component** to view its properties.
-
-5. Select the **Is Trigger** checkbox.
-
-    ![Check 'Is trigger'](media/physics-tutorials-create-a-trigger-is-trigger-checkbox.png)
-
-    This makes the collider a trigger. This means objects can pass through it, but are still detected in the code.
-
-6. We need to give the trigger a shape. Next to **Collider Shapes**, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select **Box**.
-
-    ![Add collider shape](media/physics-tutorials-create-a-trigger-add-box-shape-to-a-trigger.png)
-
-    This gives the trigger a box shape.
+3. Since we don't need the trigger to move, we'll make it a [Static Component](static-colliders.md). In the **Property Grid**, click **Add component** and select **Static component**.
 
-    ![Added trigger](media/physics-tutorials-added-trigger-area.png)
+    ![Add Static collider component](media/add-static-component.png)
 
-7. Let's make the trigger a larger area. In the **Property Grid**, under the **Transform** component properties, set the **scale** to: *X:2, Y:2, Z:2*
+4. In the **Property Grid**, expand the **Static Component** to view its properties.
 
-    ![Scale a trigger](media/physics-tutorials-create-a-trigger-scale-trigger.png)
+5. We need to give the trigger a shape. Next to **Colliders**, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select **Box**.
 
-    This doubles the size of the trigger.
+   ![Add collider shape](media/compound-types.png)
 
-    ![Added trigger](media/physics-tutorials-added-trigger-doubled-area.png)
+   This gives the trigger a box shape.
 
 ## 4. Give the trigger a model
 
@@ -127,16 +95,14 @@ We need to position the trigger between the ground and the sphere, so the ball f
     
 In the **Property Grid**, under **Transform**, set the **Position** to: *X:0, Y:3, Z:0*
 
-Now the trigger entity is between the ground and the sphere:
-
-![Trigger between ground and sphere](media/physics-tutorials-create-a-trigger-trigger-between-ground-and-sphere.png)
+Now the trigger entity is between the ground and the sphere.
 
 ## 6. Change the sphere size with script
 
-If we run the project now (**F5**), the ball falls through the trigger, but nothing happens.
+If we run the project now (**F5**), the ball bounces off the trigger, but nothing happens.
 
 <p>
-<video autoplay loop class="responsive-video" poster="media/bouncing-ball-with-trigger-no-effect.png">
+<video autoplay loop class="responsive-video">
    <source src="media/bouncing-ball-with-trigger-no-effect.mp4" type="video/mp4">
 </video>
 </p>
@@ -146,9 +112,7 @@ Let's write a script to change the size of the ball when it enters the trigger.
 >[!Note]
 >For more information about scripts, see [Scripts](../scripts/index.md).
 
-1. In the **Asset View**, click **Add asset** and select **Scripts** > **Async Script**.
-
-    ![Use a script](media/physics-tutorials-create-a-trigger-add-async-script.png)
+1. In the **Asset View**, click **Add asset** and select **Scripts** > **Sync Script**.
 
 2. In the **Create a script** dialog, name your script *Trigger* and click **Create script**.
 
@@ -158,44 +122,54 @@ Let's write a script to change the size of the ball when it enters the trigger.
 
 3. Open the script, replace its content with the following code, and save the file:
 
-    ```cs
-    using Stride.Engine;
-    using Stride.Physics;
-    using System.Threading.Tasks;
-    using Stride.Core.Mathematics;
-
-    namespace TransformTrigger
-    // You can use any namespace you like for this script.
-    {
-        public class Trigger : AsyncScript
-        {
-            public override async Task Execute()
-            {
-                var trigger = Entity.Get<PhysicsComponent>();
-                trigger.ProcessCollisions = true;
-
-                // Start state machine
-                while (Game.IsRunning)
-                {
-                    // 1. Wait for an entity to collide with the trigger
-                    var firstCollision = await trigger.NewCollision();
-
-                    var otherCollider = trigger == firstCollision.ColliderA
-                        ? firstCollision.ColliderB
-                        : firstCollision.ColliderA;
-                    otherCollider.Entity.Transform.Scale = new Vector3(2.0f, 2.0f, 2.0f);
-
-                    // 2. Wait for the entity to exit the trigger
-                    await firstCollision.Ended();
-
-                    otherCollider.Entity.Transform.Scale= new Vector3(1.0f, 1.0f, 1.0f);
-                }
-            }
-        }
-    }
-    ```
-
-    This code doubles the size (scale) of any entity that enters the trigger. When the entity exits the trigger, it returns to its original size.
+   ```cs
+   using Stride.BepuPhysics;
+   using Stride.BepuPhysics.Definitions.Contacts;
+   using Stride.Core.Mathematics;
+   using Stride.Engine;
+   
+   namespace TransformTrigger
+   {
+       // Adding IContactEventHandler to listen to contact events
+       public class Trigger : SyncScript, IContactEventHandler 
+       {
+           public override void Start()
+           {
+               // Initialization of the script.
+           }
+   
+           public override void Update()
+           {
+               // Do stuff every new frame
+           }
+   
+           // Let objects pass through this trigger, false would make objects bounce off it
+           public bool NoContactResponse => true;
+   
+           void IContactEventHandler.OnStartedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
+               ref TManifold contactManifold,
+               bool flippedManifold,
+               int workerIndex,
+               BepuSimulation bepuSimulation)
+           {
+               // When something enters inside this object
+               other.Entity.Transform.Scale = new Vector3(2.0f);
+           }
+   
+           void IContactEventHandler.OnStoppedTouching<TManifold>(CollidableComponent eventSource, CollidableComponent other,
+               ref TManifold contactManifold,
+               bool flippedManifold,
+               int workerIndex,
+               BepuSimulation bepuSimulation)
+           {
+               // When something exits this object
+               other.Entity.Transform.Scale = new Vector3(1.0f);
+           }
+       }
+   }
+   ```
+
+   This code doubles the size (scale) of any entity that enters the trigger. When the entity exits the trigger, it is set to a unit size.
 
 4. Reload the assemblies.
 
@@ -209,81 +183,23 @@ Finally, let's add this script to the trigger entity as a component.
 
     ![Add script component to entity](media/physics-tutorials-create-a-trigger-add-script-component-to-entity.png)
 
-## 8. Run the project
-
-Run the project (**F5**) to see the trigger in action.
-
-The ball falls through the trigger, doubles in size, exits the trigger, and returns to its normal size.
+3. Inside your **Static Component** click on the hand icon next to the `Contact Event Handler` property
 
-<p>
-<video autoplay loop class="responsive-video" poster="media/bouncing-ball-with-trigger-scaled_first_frame.png">
-   <source src="media/bouncing-ball-with-trigger-scaled.mp4" type="video/mp4">
-</video>
-</p>
+   ![Set contact handler](media/physics-tutorials-create-a-trigger-set-handler.png)
 
-## More ideas
+4. Select your newly created `Trigger` component and press `Ok`
 
-You can alter the script to make other changes when the sphere enters the trigger. 
+   ![Set contact handler](media/physics-tutorials-create-a-trigger-select-handler-component.png)
 
-For example, you can switch the material on the sphere entity. This script switches the material on the Sphere entity from the **Sphere Material** to the **Ground Material** and back again:
+## 8. Run the project
 
-```cs
-using Stride.Engine;
-using Stride.Physics;
-using System.Threading.Tasks;
-using Stride.Core.Mathematics;
-using Stride.Rendering;
+Run the project (**F5**) to see the trigger in action.
 
-namespace TransformTrigger
-// You can use any namespace you like for this script.
-{
-    public class Trigger : AsyncScript
-    {
-        private Material material1;
-        private Material material2;
-    
-        public override async Task Execute()
-        {
-            var trigger = Entity.Get<PhysicsComponent>();
-            trigger.ProcessCollisions = true;
-            
-            // Make sure the materials are loaded 
-            material1 = Content.Load<Material>("Sphere Material");
-            material2 = Content.Load<Material>("Ground Material");
-
-            // Start state machine
-            while (Game.IsRunning)
-            {
-                // 1. Wait for an entity to collide with the trigger
-                var firstCollision = await trigger.NewCollision();
-
-                var otherCollider = trigger == firstCollision.ColliderA
-                    ? firstCollision.ColliderB
-                    : firstCollision.ColliderA;
-                    
-                // 2. Change the material on the entity
-                otherCollider.Entity.Get<ModelComponent>().Materials[0] = material2;
-                
-                // 3. Wait for the entity to exit the trigger
-                await firstCollision.Ended();
-
-                // 4. Change the material back to the original one
-                otherCollider.Entity.Get<ModelComponent>().Materials[0] = material1;
-            }
-        }
-        
-        public override void Cancel()
-        {
-            Content.Unload(material1);
-            Content.Unload(material2);
-        }
-    }
-}
-```
+The ball falls through the trigger, doubles in size, exits the trigger, and returns to its normal size.
 
 <p>
-<video autoplay loop class="responsive-video" poster="media/bouncing-ball-with-trigger-material_first_frame.png">
-   <source src="media/bouncing-ball-with-trigger-material.mp4" type="video/mp4">
+<video autoplay loop class="responsive-video">
+   <source src="media/bouncing-ball-with-trigger-scaled.mp4" type="video/mp4">
 </video>
 </p>
 

+ 4 - 4
en/manual/physics/tutorials.md

@@ -1,7 +1,7 @@
 # Tutorials
 
-> [!WARNING]
-> This page is outdated, the information contained therein are for Bullet, the previous physics engine
+* [Create a bouncing ball](create-a-bouncing-ball.md): Use the static and body components to create a ball bouncing on a floor.
+* [Script a trigger](script-a-trigger.md): Create a trigger that doubles the size of a ball when the ball passes through it.
 
-* [Create a bouncing ball](create-a-bouncing-ball.md): Use the static collider and rigidbody components to create a ball bouncing on a floor.
-* [Script a trigger](script-a-trigger.md): Create a trigger that doubles the size of a ball when the ball passes through it.
+## See also
+* [Index](index.md)