@ignifx/physics-2d 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ignifx/physics-2d",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "ignifx 2D physics: Rigidbody2D, 2D colliders, CharacterController2D, 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/2d": "0.1.0",
49
- "@ignifx/core": "0.1.0"
48
+ "@ignifx/2d": "0.2.1",
49
+ "@ignifx/core": "0.2.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "@ignifx/core": "0.1.0",
53
- "@ignifx/2d": "0.1.0"
52
+ "@ignifx/core": "0.2.1",
53
+ "@ignifx/2d": "0.2.1"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@ignifx/2d": {
@@ -3,7 +3,7 @@ name: physics-2d
3
3
  description: Adds 2D physics to an ignifx game with @ignifx/physics-2d: Rapier 2D simulation on the fixed loop, Rigidbody2D, box/circle/capsule/polygon/edge/tilemap colliders, physics materials, 2D triggers, CharacterController2D with slopes, autostep, snap-to-ground and one-way platforms, 2D raycasts and shape queries, the collision layer matrix, and render interpolation. Use when adding or editing 2D physics bodies, 2D colliders, platformer movement, 2D triggers, or 2D queries in an ignifx project, or when the user mentions @ignifx/physics-2d, Rigidbody2D, Rapier, or CharacterController2D.
4
4
  license: Apache-2.0
5
5
  metadata:
6
- ignifx-version: "0.1.0"
6
+ ignifx-version: "0.2.1"
7
7
  ---
8
8
 
9
9
  # @ignifx/physics-2d
@@ -64,7 +64,10 @@ per fixed step:
64
64
  Systems(FixedUpdate, -100) restore the authoritative pose of interpolated bodies
65
65
  scripts.fixedUpdate(dt) forces, velocities, controller.move()
66
66
  Systems(FixedUpdate, 100) step Rapier · snapshot poses · dispatch collision and trigger events
67
- Systems(PreRender, -500) write lerp(previous, current, time.fixedStepAlpha)
67
+
68
+ once per frame, after the fixed loop:
69
+ Systems(Update, -900) write lerp(previous, current, time.fixedStepAlpha)
70
+ scripts.update · animation · scripts.lateUpdate · rendering all read that display pose
68
71
  ```
69
72
 
70
73
  - Bodies and colliders are (re)built at the **start of the next fixed step**, never mid-frame, so
@@ -156,6 +159,11 @@ Give the coin a collider with `isTrigger: true`; give the player anything that m
156
159
  receive the callback, and `trigger.other` and `trigger.otherCollider` are always the real objects —
157
160
  Rapier reports both colliders, so 2D has none of the identity gaps 3D physics documents.
158
161
 
162
+ The coin needs no `Rigidbody2D`: a collider on its own gets an implicit static body, which is the
163
+ right thing for a pickup that never moves. The player can be a `Rigidbody2D` **or** a
164
+ `CharacterController2D` — a trigger is never an obstacle to the controller, so the character walks
165
+ straight through the volume at full speed while the callbacks fire.
166
+
159
167
  ### Platformer movement
160
168
 
161
169
  ```ts run
@@ -264,6 +272,13 @@ Component field tables: `skills/ignifx/references/formats/components.md`.
264
272
  - **Autostep needs a box.** `stepOffset` clears a 0.3 m step with `shape: "box"`; with the default
265
273
  capsule of radius 0.2 it clears about 0.15 m and no more (measured, ADR-0006 Validation). Give a
266
274
  stair-climbing character `shape: "box"`.
275
+ - **A trigger is never an obstacle to a character controller.** `CharacterController2D` filters
276
+ sensors out of its collide-and-slide sweep, so it passes through an `isTrigger` collider without
277
+ slowing and the trigger callbacks fire on both entities. The flip side: a sensor never shows up in
278
+ `CharacterController2D.onCollided` — use `onTriggerEnter`/`onTriggerExit` for pickups and zones,
279
+ and `onCollided` only for the walls and floors the character actually pushed against. (Rapier's
280
+ controller counts sensors as walls unless `QueryFilterFlags.EXCLUDE_SENSORS` is passed; measured
281
+ 2026-09-08 against 0.20.0, ADR-0006 Validation.)
267
282
  - **One-way platforms are a character-controller feature.** `oneWay` changes what
268
283
  `CharacterController2D` collides with; rigid bodies fall through such a collider in both
269
284
  directions in the MVP.
@@ -276,6 +291,10 @@ Component field tables: `skills/ignifx/references/formats/components.md`.
276
291
  `-deterministic-` builds are the ones that do (ADR-0006 Validation).
277
292
  - **`angularVelocity` is degrees per second**, matching `Transform.rotation2D`, while Rapier's own
278
293
  API is radians. The `rapier` escape hatch gives you radians.
294
+ - **Interpolated poses are display-only.** Read `transform.position` in `fixedUpdate` when you need
295
+ the authoritative pose. Everything outside the fixed loop — `update`, `lateUpdate`, animation,
296
+ `Camera2DFollow`, rendering — sees the interpolated one, because the display pose is written at the
297
+ top of `Update`. That is what keeps a follow camera locked to the sprite the frame actually draws.
279
298
 
280
299
  ## Deprecated (current window)
281
300