Browse Source

Bodies and statics

Eideren 1 year ago
parent
commit
51105b9ac7

+ 3 - 3
en/manual/physics/characters.md

@@ -5,7 +5,7 @@
 
 **Characters** are used for player and NPC movement. Entities with [character components](xref:Stride.BepuPhysics.CharacterComponent) can be moved with [Move](xref:Stride.BepuPhysics.CharacterComponent.Move\(Stride.Core.Mathematics.Vector3\)), [TryJump](xref:Stride.BepuPhysics.CharacterComponent.TryJump), and teleported by setting its [Position](xref:Stride.BepuPhysics.BodyComponent.Position) property.
 
-## Add a character component to an entity
+## Add a Character Component to an Entity
 
 1. In the **Scene Editor**, select the entity you want to add the component to.
 
@@ -55,6 +55,6 @@ public class MyCharacterController : CharacterComponent
 
 ## See also
 
-* [Static colliders](static-colliders.md)
-* [Rigidbodies](rigid-bodies.md)
+* [Statics](static-colliders.md)
+* [Bodies](rigid-bodies.md)
 * [Collider shapes](collider-shapes.md)

+ 3 - 3
en/manual/physics/index.md

@@ -13,9 +13,9 @@ This section explains how physics components work, how to add them to your proje
 * [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, animals, npcs, ...)
+    * [Statics](static-colliders.md): Strong immovable objects like walls, floors, large rocks, and so on.
+    * [Bodies](rigid-bodies.md): Objects that can be knocked around, cans, balls, boxes ...
+    * [Characters](characters.md): Entities which are moved programmatically, the player character, animals, moving platforms ...
 * [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

+ 3 - 0
en/manual/physics/media/add-body-component.png

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

+ 3 - 0
en/manual/physics/media/add-static-component.png

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

+ 11 - 39
en/manual/physics/rigid-bodies.md

@@ -3,58 +3,30 @@
 <span class="badge text-bg-primary">Beginner</span>
 <span class="badge text-bg-success">Designer</span>
 
-> [!WARNING]
-> This page is outdated, the information contained therein are for Bullet, the previous physics engine
-
-**Body** move based on physical forces applied to them, such as gravity and collisions. Typical (rigid)bodies are boxes, balls, furniture, and so on — objects that are pushed, pulled, and knocked around, and also have effects on other rigidbodies they collide with.
+**Body** move based on physical forces applied to them, such as gravity and collisions. Typical (rigid)bodies are boxes, balls, furniture, and so on — objects that can be pushed, pulled, and knocked around, and also have effects on other bodies they collide with.
 
 ![Static and rigidbody colliders](media/rigid-bodies-static-and-rigid-body-colliders.png)
 
-## Add a rigidbody collider
-
-1. Select the entity you want to be a body.
-
-2. In the **Property Grid**, click **Add component** and select **body**.
+## Add a Body Component to an entity
 
-    ![Add Static collider component](media/physics-tutorials-create-a-bouncing-ball-add-rigitbody-component.png)
+1. In the **Scene Editor**, select the entity you want to add the component to.
 
-3. 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.
+2. In the **Property Grid**, click `Add component`, hover `Physics - Bepu` and select `BodyComponent`.
 
-4. Next to **Collider Shapes**, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select the shape you want.
+    ![Add body component](media/add-body-component.png)
 
-     ![Add Static collider component](media/physics-tutorials-create-a-bouncing-ball-rigitbody-shape.png)
+> [!Note]
+> You will need to set a collider for this newly created body, you can do so through the Collider property, see [collider shapes](collider-shapes.md).
 
-## Component properties
-
-You can adjust the rigidbody properties in the **Property Grid**.
-
-![Rigidbody properties](media/rigid-body-properties.png)
+> [!WARNING]
+> Never use mesh colliders for 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, see [collider shapes](collider-shapes.md).
 
-Property              | Description
-----------------------|-----------------------
-Collision Group       | Sets which collision group the object belongs to.
-Can Collide With      | Sets which groups the object collides with.
-Collision Events      | If this is enabled, the object reports collision events, which you can use in scripts. It has no effect on physics. If you have no scripts using collision events for the object, disable this option to save CPU.
-Can Sleep             | If this is enabled, the physics engine doesn't process physics objects when they're not moving. This saves CPU.
-Restitution           | Sets the amount of kinetic energy lost or gained after a collision. A typical value is between 0 and 1. 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 they collided at. Use this to change the "bounciness" of rigidbodies.
-Friction              | Sets the surface friction.
-Rolling Friction      | Sets the rolling friction.
-CCD Motion Threshold  | Sets the velocity at which continuous collision detection (CCD) takes over. CCD prevents fast-moving entities (such as bullets) erroneously passing through other entities.
-CCD Swept Sphere Radius | Sets the radius of the bounding sphere containing the position between two physics frames during continuous collision detection.
-Is Trigger            | Toggles whether the rigidbody is a [trigger](triggers.md).
-Is Kinematic          | Toggles whether the rigidbody is [kinematic](kinematic-rigid-bodies.md) and therefore moved only by its Transform property.
-Mass                  | Sets the collider mass. For large differences, use a point value; for example, write *0.1* or *10*, not *1* or *100000*.
-Linear damping        | The amount of damping for directional forces.
-Angular damping       | The amount of damping for rotational forces.
-Override Gravity      | Overrides gravity with the vector specified in Gravity.
-Gravity               | Sets a custom gravity vector applied if Override Gravity is selected.
-Node Name             | If the collider entity contains a bone structure, the node name can refer to a bones node name to be linked to that specific bone.
-Collider Shapes       | Adds a [collider shape](collider-shapes.md).
+Have a look at the [API](xref:Stride.BepuPhysics.BodyComponent) for more detail on the properties of this component.
 
 ## See also
 
 * [Kinematic rigidbodies](kinematic-rigid-bodies.md)
-* [Static colliders](static-colliders.md)
+* [Statics](static-colliders.md)
 * [Characters](characters.md)
 * [Collider shapes](collider-shapes.md)
 * [Triggers](triggers.md)

+ 11 - 40
en/manual/physics/static-colliders.md

@@ -1,61 +1,32 @@
-# Static colliders
+# Static
 
 <span class="badge text-bg-primary">Beginner</span>
 <span class="badge text-bg-success">Designer</span>
 
-> [!WARNING]
-TODO
-
 **Static colliders** aren't moved by forces such as gravity and collisions, but other physics objects can bump into them. Typical static colliders are strong immovable objects like walls, floors, large rocks, and so on.
 
 ![Static and rigidbody colliders](media/rigid-bodies-static-and-rigid-body-colliders.png)
 
-## Add a static collider
-   
-1. Select the entity you want to make a static collider.
-
-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)
-
-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.
-
-4. Next to **Collider Shapes**, click ![Green plus button](~/manual/game-studio/media/green-plus-icon.png) (**Add**) and select the shape you want.
-
-    ![Add Static collider component](media/physics-tutorials-create-a-bouncing-ball-collider-shape.png)
+## Add a Static Component to an Entity
 
-## Static collider properties
+1. In the **Scene Editor**, select the entity you want to add the component to.
 
-You can adjust the static collider properties in the **Property Grid**.
+2. In the **Property Grid**, click `Add component`, hover `Physics - Bepu` and select `StaticComponent`.
 
-![Static collider properties](media/static-collider-properties.png)
+   ![Add static component](media/add-static-component.png)
 
-Property              |   Description
-----------------------|-----------------------
-Collision Group       | Sets which collision group the object belongs to.
-Can Collide With      | Sets which groups the object collides with.
-Collision Events      | If this is enabled, the object reports collision events, which you can use in scripts. It has no effect on physics. If you have no scripts using collision events for the object, disable this option to save CPU.
-Can Sleep             | If this is enabled, the physics engine doesn't process physics objects when they're not moving. This saves CPU.
-Restitution           | Sets the amount of kinetic energy lost or gained after a collision. A typical value is between 0 and 1. 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 they collided at. Use this to change the "bounciness" of rigidbodies.
-Friction              | Sets the surface friction.
-Rolling Friction      | Sets the rolling friction.
-CCD Motion Threshold  | Sets the velocity at which continuous collision detection (CCD) takes over. CCD prevents fast-moving entities (such as bullets) erroneously passing through other entities.
-CCD Swept Sphere Radius | Sets the radius of the bounding sphere containing the position between two physics frames during continuous collision detection.
-Is Trigger            | Toggles whether the static collider is a [trigger](triggers.md).
+> [!Note]
+> You will need to set a collider for this newly created static component, you can do so through the Collider property, see [collider shapes](collider-shapes.md).
 
-## Move a static collider at runtime
+Have a look at the [API](xref:Stride.BepuPhysics.StaticComponent) for more detail on the properties of this component.
 
-If you need to move a static collider at runtime, you can do it with a script:
+## Moving Static Components at Runtime
 
-```cs
-PhysicsComponent.Entity.Transform.Position += PhysicsComponent.Entity.Transform.Position + Vector3.UnitX;
-PhysicsComponent.Entity.Transform.UpdateWorldMatrix();
-PhysicsComponent.UpdatePhysicsTransformation();
-```
+Moving a static collider while your game runs is generally not recommended as it will lead to unexpected collision issues and performance degradation. Moving it every couple of seconds should be fine, but if you have to move it more frequently, use a [Body](rigid-bodies.md) instead.
 
 ## See also
 
-* [Rigidbodies](rigid-bodies.md)
+* [Bodies](rigid-bodies.md)
 * [Characters](characters.md)
 * [Collider shapes](collider-shapes.md)
 * [Triggers](triggers.md)