@ignifx/physics 0.21.0 → 0.22.0
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/README.md +22 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/skills/physics/SKILL.md +38 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ignifx/physics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "ignifx 3D physics on Havok through Babylon Lite: rigidbodies, colliders, triggers, character controller, queries.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ignifx",
|
|
@@ -45,13 +45,13 @@
|
|
|
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.
|
|
49
|
-
"@ignifx/terrain": "0.
|
|
48
|
+
"@ignifx/core": "0.22.0",
|
|
49
|
+
"@ignifx/terrain": "0.22.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@babylonjs/havok": "^1.3.14",
|
|
53
53
|
"@babylonjs/lite": "1.34.0",
|
|
54
|
-
"@ignifx/core": "0.
|
|
54
|
+
"@ignifx/core": "0.22.0"
|
|
55
55
|
},
|
|
56
56
|
"ignifx": {
|
|
57
57
|
"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.
|
|
6
|
+
ignifx-version: "0.22.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# @ignifx/physics
|
|
@@ -21,8 +21,8 @@ through, or has to be asked "what is under the crosshair".
|
|
|
21
21
|
|
|
22
22
|
## Environment
|
|
23
23
|
|
|
24
|
-
- Engine: ignifx `0.
|
|
25
|
-
- Peer dependencies: `@babylonjs/lite` (exactly `1.34.0`) and `@babylonjs/havok` (`^1.3.
|
|
24
|
+
- Engine: ignifx `0.22.0`; this package targets `@ignifx/core` `>=0.0.0 <1.0.0`.
|
|
25
|
+
- Peer dependencies: `@babylonjs/lite` (exactly `1.34.0`) and `@babylonjs/havok` (`^1.3.14`).
|
|
26
26
|
- Browsers, Electron, and Node. The Vite plugin copies `HavokPhysics.wasm` into the public asset
|
|
27
27
|
path, so the browser loads it from `assets/HavokPhysics.wasm`; under Node the extension reads the
|
|
28
28
|
binary out of the installed `@babylonjs/havok` package, so a headless test needs no setup.
|
|
@@ -37,14 +37,14 @@ await app.start();
|
|
|
37
37
|
|
|
38
38
|
`ignifx.config.ts` carries the settings under `physics`:
|
|
39
39
|
|
|
40
|
-
| Setting
|
|
41
|
-
|
|
|
42
|
-
| `gravity`
|
|
43
|
-
| `collisionMatrix` | `{}`
|
|
44
|
-
| `defaultMaterial` | friction `0.6`
|
|
45
|
-
| `velocityLimits`
|
|
46
|
-
| `interpolation`
|
|
47
|
-
| `havokWasm`
|
|
40
|
+
| Setting | Default | Meaning |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `gravity` | `{x:0,y:-9.81,z:0}` | World gravity, m/s² |
|
|
43
|
+
| `collisionMatrix` | `{}` | `{ layerName: [layerNames] }`; an unlisted layer collides with all |
|
|
44
|
+
| `defaultMaterial` | friction `0.6` | The surface a collider with no material of its own uses |
|
|
45
|
+
| `velocityLimits` | `{linear:0,angular:0}` | World speed clamps; `0` leaves Havok's own defaults |
|
|
46
|
+
| `interpolation` | `true` | Whether dynamic bodies interpolate between fixed steps |
|
|
47
|
+
| `havokWasm` | `"auto"` | `"auto"` resolves through the asset manifest, or give a URL |
|
|
48
48
|
|
|
49
49
|
`fixedDeltaTime` is **not** here: the step comes from the core `time` section and `app.time`.
|
|
50
50
|
|
|
@@ -100,16 +100,16 @@ app.log.info("crate at y:", crate.transform.position.y);
|
|
|
100
100
|
|
|
101
101
|
### `app.physics`
|
|
102
102
|
|
|
103
|
-
| Member
|
|
104
|
-
|
|
|
105
|
-
| `gravity`
|
|
106
|
-
| `raycast(origin, direction, maxDistance?, options?)`
|
|
107
|
-
| `shapeCast(shape, from, to, options?)`
|
|
108
|
-
| `overlap(shape, position, rotation?, options?)`
|
|
109
|
-
| `distanceToNearest(shape, position, maxDistance, options?)` | Distance to the closest body, or `Infinity`
|
|
110
|
-
| `debugViewer.enabled`
|
|
111
|
-
| `colliderOutlines(entity)`
|
|
112
|
-
| `lite`
|
|
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
|
+
| `colliderOutlines(entity)` | Each enabled collider's outline as world-space line segments (`Float32Array`, six numbers a segment) and `isTrigger`: an editor's collider gizmos; works headless |
|
|
112
|
+
| `lite` | Unstable escape hatch: the Havok world and the simulation scene |
|
|
113
113
|
|
|
114
114
|
Every query needs at least one completed fixed step — Havok builds its broadphase there — and
|
|
115
115
|
reports `IGX-0902` before that, except in an edit-mode app (below).
|
|
@@ -121,18 +121,18 @@ cannot be layer-filtered, and reports `entity: null` — use `options.ignore` to
|
|
|
121
121
|
|
|
122
122
|
### `Rigidbody`
|
|
123
123
|
|
|
124
|
-
| Field / member
|
|
125
|
-
|
|
|
126
|
-
| `bodyType`
|
|
127
|
-
| `mass`
|
|
128
|
-
| `startAsleep`
|
|
129
|
-
| `freezeRotation`
|
|
130
|
-
| `interpolation`
|
|
131
|
-
| `collisionEvents`
|
|
132
|
-
| `kinematicSync`
|
|
133
|
-
| `linearVelocity` / `angularVelocity`
|
|
134
|
-
| `addForce(f, point?)` / `addImpulse(i, point?)` | —
|
|
135
|
-
| `teleport(position, rotation?)`
|
|
124
|
+
| Field / member | Default | Meaning |
|
|
125
|
+
| --- | --- | --- |
|
|
126
|
+
| `bodyType` | `"dynamic"` | `"dynamic"`, `"kinematic"`, or `"static"` |
|
|
127
|
+
| `mass` | `1` | Kilograms; dynamic bodies only |
|
|
128
|
+
| `startAsleep` | `false` | Whether Havok starts it asleep |
|
|
129
|
+
| `freezeRotation` | all `false` | Locks rotation about X, Y, or Z |
|
|
130
|
+
| `interpolation` | `"interpolate"` | `"none"` pins the display pose to the last step |
|
|
131
|
+
| `collisionEvents` | `"auto"` | `"auto"` follows the scripts on the entity |
|
|
132
|
+
| `kinematicSync` | `"teleport"` | `"velocity"` drags resting bodies along instead |
|
|
133
|
+
| `linearVelocity` / `angularVelocity` | — | Read and write; `…ToRef` variants allocate nothing |
|
|
134
|
+
| `addForce(f, point?)` / `addImpulse(i, point?)` | — | Call from `fixedUpdate` |
|
|
135
|
+
| `teleport(position, rotation?)` | — | Moves without integrating, and resets interpolation |
|
|
136
136
|
|
|
137
137
|
### Colliders
|
|
138
138
|
|
|
@@ -226,8 +226,8 @@ collides with everything. Havok tests a pair in both directions, so one side ref
|
|
|
226
226
|
## File formats
|
|
227
227
|
|
|
228
228
|
- `*.physicsmaterial.json` — `ignifx.physicsmaterial`: `friction`, `staticFriction`, `restitution`.
|
|
229
|
-
See `skills/ignifx/references/formats/ignifx.physicsmaterial.md
|
|
230
|
-
- Component fields as they appear in a scene file: `
|
|
229
|
+
See `skills/ignifx/references/formats/ignifx.physicsmaterial.md` in the `ignifx` package.
|
|
230
|
+
- Component fields as they appear in a scene file: `components.md` beside it.
|
|
231
231
|
|
|
232
232
|
## Gotchas
|
|
233
233
|
|
|
@@ -268,5 +268,6 @@ None (pre-1.0: no deprecation window; breaking changes are listed in the changel
|
|
|
268
268
|
|
|
269
269
|
## Where to look next
|
|
270
270
|
|
|
271
|
-
`skills/ignifx/SKILL.md`
|
|
272
|
-
the
|
|
271
|
+
The entry skill is `skills/ignifx/SKILL.md` in the `ignifx` package: `node_modules/ignifx/` in an
|
|
272
|
+
installed project, the repository root in the engine repository. Under it, `references/api/physics.md` has every exact signature and `references/formats/` the
|
|
273
|
+
physics material and component field tables.
|