You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bodies are registered via `Modifier.physicsBody(...)`. The modifier binds a Composable to a physics body and allows the runtime to drive its translation and rotation.
3
+
Bodies (childs) are registered via `Modifier.physicsBody(...)` as a first childs of the PhysicsBox. The modifier binds a Composable to a physics body and allows the runtime to drive its translation and rotation.
4
4
5
5
## Basic usage
6
6
```kotlin
@@ -16,24 +16,31 @@ Box(
16
16
- Use immutable types (`String`, `Long`, enums) when possible.
17
17
18
18
## PhysicsBodyConfig
19
-
`PhysicsBodyConfig` defines material and motion parameters:
The runtime drains commands and applies them to the physics backend.
18
+
- apply an impulse or set velocity for bodies by their keys (`enqueueImpulse(...)`, `enqueueVelocity(...)`).
19
+
- etc. (see API)
20
20
21
21
## Fixed‑step stepping
22
22
PhysicsBox uses a fixed timestep to keep simulation stable across frame rates. See `StepConfig`:
@@ -30,7 +30,7 @@ Gravity is configured in **physics units** (m/s²). The default is:
30
30
```kotlin
31
31
PhysicsDefaults.Gravity// (0f, 9.8f)
32
32
```
33
-
Update it via`PhysicsBoxState.setWorldGravity(...)`.
33
+
Update it using`PhysicsBoxState.updateGravity(...)`.
34
34
35
35
## Boundaries
36
36
`BoundariesConfig` creates static walls around the container. This keeps bodies inside the visible area and lets you control restitution/friction at the edges.
The default shape for any .physicsBody() is Square. As you can see from the example, the Compose shape should match the PhysicsShape (but it is not required). You also do not have to define the size for PhysicsShape: it takes the size from the composable (but you can override it if you need different sizes for the physical and composable shapes).
0 commit comments