create-dreamer-app 1.0.7 → 1.0.8
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
|
@@ -273,6 +273,8 @@ Rectangle bounds use their top-left corner; circle bounds use their center. `pos
|
|
|
273
273
|
|
|
274
274
|
Call these each frame with the body's public `key`. The handler receives the other body's public key once per reported body pair per frame.
|
|
275
275
|
|
|
276
|
+
- `gameCollision` calls `handler(otherKey: string, otherLayer: string)`, passing the other body's public key and layer. The layer is always defined for a physical collision.
|
|
277
|
+
- `gameHit` calls `handler(otherKey: string)`, passing only the other body's public key.
|
|
276
278
|
- Physical collisions require both bodies to include each other's `layer` in `collidesWith`.
|
|
277
279
|
- Hits are directional: only the observing body's `hitsWith` needs to include the other body's layer.
|
|
278
280
|
- Hits alone do not separate bodies or change their velocities.
|
|
@@ -280,8 +282,8 @@ Call these each frame with the body's public `key`. The handler receives the oth
|
|
|
280
282
|
|
|
281
283
|
```tsx
|
|
282
284
|
function PhysicsExample() {
|
|
283
|
-
gameCollision("ball", (otherKey) => {
|
|
284
|
-
if (
|
|
285
|
+
gameCollision("ball", (otherKey, otherLayer) => {
|
|
286
|
+
if (otherLayer === "world") console.log("Ball contacted world body:", otherKey);
|
|
285
287
|
});
|
|
286
288
|
|
|
287
289
|
return (
|