@ignifx/physics 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +42 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -17
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/physics/SKILL.md +18 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ignifx/physics",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "ignifx 3D physics on Havok through Babylon Lite: rigidbodies, colliders, triggers, character controller, queries.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ignifx",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"typedoc-plugin-markdown": "^4.13.0",
|
|
46
46
|
"typescript-native": "npm:typescript@7.0.2",
|
|
47
47
|
"vitest": "^5.0.0",
|
|
48
|
-
"@ignifx/core": "0.2.
|
|
48
|
+
"@ignifx/core": "0.2.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@babylonjs/havok": "^1.3.14",
|
|
52
52
|
"@babylonjs/lite": "1.27.0",
|
|
53
|
-
"@ignifx/core": "0.2.
|
|
53
|
+
"@ignifx/core": "0.2.1"
|
|
54
54
|
},
|
|
55
55
|
"ignifx": {
|
|
56
56
|
"extension": true,
|
package/skills/physics/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: physics
|
|
|
3
3
|
description: Adds 3D physics to an ignifx game with @ignifx/physics: Havok simulation on a separate headless scene, Rigidbody, box/sphere/capsule/mesh colliders, physics materials, triggers, CharacterController, raycasts and shape queries, the collision layer matrix, and render interpolation. Use when adding or editing 3D physics bodies, colliders, triggers, character movement, or physics queries in an ignifx project, or when the user mentions @ignifx/physics, Rigidbody, Havok, or collision layers.
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
metadata:
|
|
6
|
-
ignifx-version: "0.2.
|
|
6
|
+
ignifx-version: "0.2.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# @ignifx/physics
|
|
@@ -61,7 +61,10 @@ per fixed step:
|
|
|
61
61
|
Systems(FixedUpdate, -100) restore the authoritative pose of interpolated bodies
|
|
62
62
|
scripts.fixedUpdate(dt) forces, velocities, controller.move()
|
|
63
63
|
Systems(FixedUpdate, 100) step Havok · snapshot poses · dispatch collision and trigger events
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
once per frame, after the fixed loop:
|
|
66
|
+
Systems(Update, -900) write lerp(previous, current, time.fixedStepAlpha)
|
|
67
|
+
scripts.update · animation · scripts.lateUpdate · rendering all read that display pose
|
|
65
68
|
```
|
|
66
69
|
|
|
67
70
|
- Colliders and bodies are (re)built at the **start of the next fixed step**, never mid-frame, so
|
|
@@ -97,15 +100,15 @@ app.log.info("crate at y:", crate.transform.position.y);
|
|
|
97
100
|
|
|
98
101
|
### `app.physics`
|
|
99
102
|
|
|
100
|
-
| Member | What it does
|
|
101
|
-
| ----------------------------------------------------------- |
|
|
102
|
-
| `gravity` | World gravity; assigning it takes effect on the next step
|
|
103
|
-
| `raycast(origin, direction, maxDistance?, options?)` | First entity along a ray, with point, normal, and distance
|
|
104
|
-
| `shapeCast(shape, from, to, options?)` | Sweeps a sphere/box/capsule and reports the first contact
|
|
105
|
-
| `overlap(shape, position, rotation?, options?)` | Entities whose world bounds the shape touches (array is reused)
|
|
106
|
-
| `distanceToNearest(shape, position, maxDistance, options?)` | Distance to the closest body, or `Infinity`
|
|
107
|
-
| `debugViewer.enabled` | Lite's wireframe overlay on the render scene (needs a GPU)
|
|
108
|
-
| `lite` | Unstable escape hatch: the Havok world and the simulation scene
|
|
103
|
+
| Member | What it does |
|
|
104
|
+
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
105
|
+
| `gravity` | World gravity; assigning it takes effect on the next step |
|
|
106
|
+
| `raycast(origin, direction, maxDistance?, options?)` | First entity along a ray, with point, normal, and distance |
|
|
107
|
+
| `shapeCast(shape, from, to, options?)` | Sweeps a sphere/box/capsule and reports the first contact; `options.ignore` names one entity the sweep passes through — the caller's own body, when the sweep starts inside it |
|
|
108
|
+
| `overlap(shape, position, rotation?, options?)` | Entities whose world bounds the shape touches (array is reused) |
|
|
109
|
+
| `distanceToNearest(shape, position, maxDistance, options?)` | Distance to the closest body, or `Infinity` |
|
|
110
|
+
| `debugViewer.enabled` | Lite's wireframe overlay on the render scene (needs a GPU) |
|
|
111
|
+
| `lite` | Unstable escape hatch: the Havok world and the simulation scene |
|
|
109
112
|
|
|
110
113
|
Every query needs at least one completed fixed step — Havok builds its broadphase there — and
|
|
111
114
|
reports `IGX-0902` before that.
|
|
@@ -238,7 +241,10 @@ collides with everything. Havok tests a pair in both directions, so one side ref
|
|
|
238
241
|
- **A body's entity must be a root entity** (`IGX-0907`), and a moving collider needs a
|
|
239
242
|
`Rigidbody` (`IGX-0901`).
|
|
240
243
|
- **Interpolated poses are display-only.** Read `transform.position` in `fixedUpdate` when you need
|
|
241
|
-
the authoritative pose
|
|
244
|
+
the authoritative pose. Everything outside the fixed loop — `update`, `lateUpdate`, animation,
|
|
245
|
+
camera rigs, rendering — sees the interpolated one, because the display pose is written at the top
|
|
246
|
+
of `Update`. That is deliberate: a follow camera in `lateUpdate` must frame the character where the
|
|
247
|
+
frame draws it, or the two judder against each other.
|
|
242
248
|
- **A resting body sleeps.** Changing `app.physics.gravity` does not wake it; apply an impulse.
|
|
243
249
|
|
|
244
250
|
## Deprecated (current window)
|