@pmndrs/viverse 0.1.12 → 0.1.13
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/physics/world.d.ts +2 -2
- package/dist/physics/world.js +8 -8
- package/package.json +1 -1
package/dist/physics/world.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare class BvhPhysicsWorld {
|
|
|
6
6
|
* @deprecated use addBody(object, false) instead
|
|
7
7
|
*/
|
|
8
8
|
addFixedBody(object: Object3D): void;
|
|
9
|
-
addBody(object: Object3D,
|
|
10
|
-
|
|
9
|
+
addBody(object: Object3D, kinematic: boolean): void;
|
|
10
|
+
removeBody(object: Object3D): void;
|
|
11
11
|
private computeMatrix;
|
|
12
12
|
shapecast(intersectsBounds: (box: Box3) => boolean, intersectsTriangle: (triangle: ExtendedTriangle) => void): void;
|
|
13
13
|
raycast(ray: Ray, far: number): number | undefined;
|
package/dist/physics/world.js
CHANGED
|
@@ -13,17 +13,17 @@ export class BvhPhysicsWorld {
|
|
|
13
13
|
addFixedBody(object) {
|
|
14
14
|
this.addBody(object, false);
|
|
15
15
|
}
|
|
16
|
-
addBody(object,
|
|
16
|
+
addBody(object, kinematic) {
|
|
17
17
|
object.updateWorldMatrix(true, true);
|
|
18
18
|
if (!(object instanceof InstancedMesh)) {
|
|
19
19
|
const parent = object.parent;
|
|
20
|
-
if (
|
|
20
|
+
if (kinematic) {
|
|
21
21
|
object.parent = null;
|
|
22
22
|
object.updateMatrixWorld(true);
|
|
23
23
|
}
|
|
24
24
|
const geometry = new StaticGeometryGenerator(object).generate();
|
|
25
|
-
this.map.push({ object, bvh: computeBoundsTree.apply(geometry),
|
|
26
|
-
if (
|
|
25
|
+
this.map.push({ object, bvh: computeBoundsTree.apply(geometry), kinematic });
|
|
26
|
+
if (kinematic) {
|
|
27
27
|
object.parent = parent;
|
|
28
28
|
object.updateMatrixWorld(true);
|
|
29
29
|
}
|
|
@@ -38,15 +38,15 @@ export class BvhPhysicsWorld {
|
|
|
38
38
|
object,
|
|
39
39
|
bvh,
|
|
40
40
|
instanceIndex: i,
|
|
41
|
-
|
|
41
|
+
kinematic,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
removeBody(object) {
|
|
46
46
|
this.map = this.map.filter((entry) => entry.object != object);
|
|
47
47
|
}
|
|
48
|
-
computeMatrix({
|
|
49
|
-
if (!
|
|
48
|
+
computeMatrix({ kinematic, object, instanceIndex }, target) {
|
|
49
|
+
if (!kinematic && instanceIndex == null) {
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
52
|
if (instanceIndex == null) {
|