@relu-interactives/spatial-ecs 0.3.8 → 0.3.9
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/dist/{chunk-LMTB4KQ4.js → chunk-W5TSYV6Q.js} +21 -12
- package/dist/chunk-W5TSYV6Q.js.map +1 -0
- package/dist/index.cjs +19 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +2 -2
- package/dist/systems/index.cjs +18 -9
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-LMTB4KQ4.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -4777,13 +4777,9 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
4777
4777
|
runtimeMessage: typeof entry.runtimeMessage === "string" ? entry.runtimeMessage : void 0
|
|
4778
4778
|
};
|
|
4779
4779
|
}).filter((entry) => entry.className || entry.scriptUrl) : [];
|
|
4780
|
-
if (
|
|
4781
|
-
|
|
4780
|
+
if (entries.length) {
|
|
4781
|
+
world.addComponent(targetEntityId, new ScriptComponent(entries));
|
|
4782
4782
|
}
|
|
4783
|
-
world.addComponent(
|
|
4784
|
-
targetEntityId,
|
|
4785
|
-
new ScriptComponent(entries)
|
|
4786
|
-
);
|
|
4787
4783
|
}
|
|
4788
4784
|
const sourceScriptObject = asRecord3(values.scriptObjectValues.get(sourceEntityId));
|
|
4789
4785
|
if (sourceScriptObject) {
|
|
@@ -4832,10 +4828,14 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
4832
4828
|
const sourceInteractable = asRecord3(
|
|
4833
4829
|
values.xrInteractableValues.get(sourceEntityId)
|
|
4834
4830
|
);
|
|
4835
|
-
|
|
4831
|
+
let interactable = world.getComponent(
|
|
4836
4832
|
targetEntityId,
|
|
4837
4833
|
XRInteractableComponent
|
|
4838
4834
|
);
|
|
4835
|
+
if (sourceInteractable && !interactable) {
|
|
4836
|
+
interactable = new XRInteractableComponent();
|
|
4837
|
+
world.addComponent(targetEntityId, interactable);
|
|
4838
|
+
}
|
|
4839
4839
|
if (sourceInteractable && interactable) {
|
|
4840
4840
|
if (typeof sourceInteractable.enabled === "boolean") {
|
|
4841
4841
|
interactable.enabled = sourceInteractable.enabled;
|
|
@@ -4892,7 +4892,11 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
4892
4892
|
const sourceHandPose = asRecord3(
|
|
4893
4893
|
values.xrHandPoseValues.get(sourceEntityId)
|
|
4894
4894
|
);
|
|
4895
|
-
|
|
4895
|
+
let handPose = world.getComponent(targetEntityId, XRHandPoseComponent);
|
|
4896
|
+
if (sourceHandPose && !handPose) {
|
|
4897
|
+
handPose = new XRHandPoseComponent();
|
|
4898
|
+
world.addComponent(targetEntityId, handPose);
|
|
4899
|
+
}
|
|
4896
4900
|
if (sourceHandPose && handPose) {
|
|
4897
4901
|
if (typeof sourceHandPose.enabled === "boolean") {
|
|
4898
4902
|
handPose.enabled = sourceHandPose.enabled;
|
|
@@ -10875,6 +10879,7 @@ __name(_XRInputSystem, "XRInputSystem");
|
|
|
10875
10879
|
var XRInputSystem = _XRInputSystem;
|
|
10876
10880
|
var VELOCITY_SAMPLES = 5;
|
|
10877
10881
|
var MAX_SAMPLE_AGE_SECONDS = 0.2;
|
|
10882
|
+
var MAX_PLAUSIBLE_SPEED = 20;
|
|
10878
10883
|
var _ThrowVelocityTracker = class _ThrowVelocityTracker {
|
|
10879
10884
|
constructor() {
|
|
10880
10885
|
this.samples = [];
|
|
@@ -10908,6 +10913,7 @@ var _ThrowVelocityTracker = class _ThrowVelocityTracker {
|
|
|
10908
10913
|
if (dt <= 1e-5) continue;
|
|
10909
10914
|
const velocity = new THREE39__namespace.Vector3().subVectors(current.position, previous.position).divideScalar(dt);
|
|
10910
10915
|
const speed = velocity.length();
|
|
10916
|
+
if (speed > MAX_PLAUSIBLE_SPEED) continue;
|
|
10911
10917
|
if (speed > bestSpeed) {
|
|
10912
10918
|
bestSpeed = speed;
|
|
10913
10919
|
best = velocity;
|
|
@@ -11057,7 +11063,9 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
11057
11063
|
if (!interactable?.enabled) continue;
|
|
11058
11064
|
if (!world.isEntityVisible(entityId)) continue;
|
|
11059
11065
|
const object = world.getComponent(entityId, Object3DRef)?.object;
|
|
11060
|
-
if (object)
|
|
11066
|
+
if (object) {
|
|
11067
|
+
out.push({ entityId, object, pointable: interactable.pointable });
|
|
11068
|
+
}
|
|
11061
11069
|
}
|
|
11062
11070
|
return out;
|
|
11063
11071
|
}
|
|
@@ -11069,6 +11077,7 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
11069
11077
|
let nearestId = null;
|
|
11070
11078
|
let nearestDistance = Number.POSITIVE_INFINITY;
|
|
11071
11079
|
for (const entry of interactables) {
|
|
11080
|
+
if (!entry.pointable) continue;
|
|
11072
11081
|
const hit = this.raycaster.intersectObject(entry.object, true)[0];
|
|
11073
11082
|
if (!hit) continue;
|
|
11074
11083
|
if (hit.distance < nearestDistance) {
|
|
@@ -13997,6 +14006,7 @@ exports.InstancedMeshSystem = InstancedMeshSystem;
|
|
|
13997
14006
|
exports.KeyboardKeys = KeyboardKeys;
|
|
13998
14007
|
exports.LightSyncSystem = LightSyncSystem;
|
|
13999
14008
|
exports.MATCH_FALLOFF = MATCH_FALLOFF;
|
|
14009
|
+
exports.MAX_PLAUSIBLE_SPEED = MAX_PLAUSIBLE_SPEED;
|
|
14000
14010
|
exports.MAX_SAMPLE_AGE_SECONDS = MAX_SAMPLE_AGE_SECONDS;
|
|
14001
14011
|
exports.MaterialSyncSystem = MaterialSyncSystem;
|
|
14002
14012
|
exports.MeshGeometrySystem = MeshGeometrySystem;
|