@daneren2005/shared-memory-physics 1.7.2 → 1.7.3
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 +3 -3
- package/dist/components/transform-component.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ npm install @daneren2005/shared-memory-physics @daneren2005/shared-memory-ecs @d
|
|
|
19
19
|
| Component | Config | Serialization | Block |
|
|
20
20
|
| --------------- | -------------------------------------------- | -------------------------- | ---------------------------------------------- |
|
|
21
21
|
| `dynamics` | - | `accelerationX?`, `accelerationY?`, `mass?` | `Float32Array` - acceleration and inverse mass |
|
|
22
|
-
| `transform` | `width`, `height`, `angle?` / `radius` | `x`, `y`, `angle
|
|
22
|
+
| `transform` | `width`, `height`, `angle?` / `radius` | `x`, `y`, `angle?` | `Float32Array` – where, how big, facing |
|
|
23
23
|
| `velocity` | – | `velocityX?`, `velocityY?`, `damping?` | `Float32Array` – world units per second |
|
|
24
24
|
| `body` | `shape?`, `collideCategory?`, `collideMask?`, `sensor?`, `continuousCollisionDetection?`, `blocksPath?` | – | `Uint32Array` – what shape, what collides with |
|
|
25
25
|
| `interpolation` | `interpolate` | – | `Float32Array` – where to *draw* it |
|
|
@@ -59,8 +59,8 @@ effective mass `1` when a force or impulse is queued for it.
|
|
|
59
59
|
The transform is split in two. **Config** is what your entity template says - `width` and `height` are
|
|
60
60
|
required, `angle` defaults to `0` - and a size is what loads the component at all: a config with neither a
|
|
61
61
|
width nor a height does not get a transform. **Serialization** is the live state that changes as the world
|
|
62
|
-
runs, so `save()` returns `x` / `y` and `angle
|
|
63
|
-
template rather than the save.
|
|
62
|
+
runs, so `save()` returns `x` / `y` and includes `angle` only when it is nonzero. An omitted angle defaults
|
|
63
|
+
to `0` on load, while a reloaded entity gets its size back from your own template rather than the save.
|
|
64
64
|
|
|
65
65
|
`x` / `y` are the **centre** of the box, not a corner: the box is rotated about that point and collision
|
|
66
66
|
projects out from it in both directions. `angle` is in **radians** counter-clockwise from the +x axis, and
|
package/dist/index.js
CHANGED
|
@@ -131,11 +131,11 @@ var v = 0, y = 1, b = 2, x = 3, S = 4, C = 5, w = class extends t {
|
|
|
131
131
|
return new w(t.getBlock(n), n);
|
|
132
132
|
},
|
|
133
133
|
save(e) {
|
|
134
|
-
|
|
134
|
+
let t = {
|
|
135
135
|
x: e.x,
|
|
136
|
-
y: e.y
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
y: e.y
|
|
137
|
+
}, n = e.angle;
|
|
138
|
+
return n !== 0 && (t.angle = n), t;
|
|
139
139
|
}
|
|
140
140
|
}, E = 0, D = 1, O = 2, k = 3, A = class extends t {
|
|
141
141
|
get velocityX() {
|