@daneren2005/shared-memory-physics 1.9.0 → 1.9.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/README.md CHANGED
@@ -839,6 +839,11 @@ const clicked = world.findNearestSpatial(mouseX, mouseY, 0);
839
839
  const nearby = world.searchSpatialAround(x, y, 100, 100);
840
840
  ```
841
841
 
842
+ The map defaults to `type: Float64Array`. Entity ids are never reused, so a `Float32` map, which only holds ids
843
+ below 2^24 (~16.7M), runs out after that many entities have *ever* been created. `Float64` covers the whole
844
+ uint32 eid range for about 1.4x the memory per entity. Pass `spatial: { type: Float32Array }` only if a world
845
+ will create fewer entities than that over its lifetime.
846
+
842
847
  `searchSpatial`, `searchSpatialAround`, `findNearestSpatial`, and `findNearbySpatial` return live entities and
843
848
  accept entity filters. Shape-aware axis-aligned bounds are stored: rotated rectangles and capsules occupy the
844
849
  box around their actual outline. A direct transform/body edit outside the physics update must be followed by
package/dist/index.js CHANGED
@@ -718,7 +718,10 @@ var $t = class extends e {
718
718
  spatialIds = /* @__PURE__ */ new Set();
719
719
  constructor(e, t = {}) {
720
720
  let { spatial: n, ...r } = t;
721
- super(e, r), this.spatialMap = new o(this.heap, n), this.on("entity-added", (e) => {
721
+ super(e, r), this.spatialMap = new o(this.heap, {
722
+ type: Float64Array,
723
+ ...n
724
+ }), this.on("entity-added", (e) => {
722
725
  this.updateSpatialEntity(e), e.on("component-added", (t) => {
723
726
  (t === "transform" || t === "body") && this.updateSpatialEntity(e);
724
727
  }), e.on("component-removed", (t) => {