@babylonjs/core 6.40.0 → 6.41.0
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/Animations/runtimeAnimation.js +2 -2
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Debug/physicsViewer.js +2 -2
- package/Debug/physicsViewer.js.map +1 -1
- package/Engines/thinEngine.js +2 -3
- package/Engines/thinEngine.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +8 -7
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +7 -6
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +9 -12
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +8 -7
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/drawWrapper.d.ts +15 -0
- package/Materials/drawWrapper.js +15 -0
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +0 -16
- package/Materials/effect.js +0 -16
- package/Materials/effect.js.map +1 -1
- package/Materials/effectRenderer.js +0 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/material.d.ts +3 -2
- package/Materials/material.js +14 -12
- package/Materials/material.js.map +1 -1
- package/Materials/pushMaterial.d.ts +2 -2
- package/Materials/pushMaterial.js +9 -6
- package/Materials/pushMaterial.js.map +1 -1
- package/Materials/shaderMaterial.js +10 -16
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +8 -7
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Builders/boxBuilder.d.ts +0 -33
- package/Meshes/Builders/boxBuilder.js +0 -33
- package/Meshes/Builders/boxBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.d.ts +0 -31
- package/Meshes/Builders/cylinderBuilder.js +0 -31
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.d.ts +0 -7
- package/Meshes/Builders/decalBuilder.js +0 -7
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.d.ts +0 -13
- package/Meshes/Builders/discBuilder.js +0 -13
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/geodesicBuilder.d.ts +0 -13
- package/Meshes/Builders/geodesicBuilder.js +0 -13
- package/Meshes/Builders/geodesicBuilder.js.map +1 -1
- package/Meshes/Builders/hemisphereBuilder.d.ts +0 -3
- package/Meshes/Builders/hemisphereBuilder.js +0 -3
- package/Meshes/Builders/hemisphereBuilder.js.map +1 -1
- package/Meshes/Builders/icoSphereBuilder.d.ts +0 -19
- package/Meshes/Builders/icoSphereBuilder.js +0 -19
- package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
- package/Meshes/Builders/latheBuilder.d.ts +0 -12
- package/Meshes/Builders/latheBuilder.js +0 -12
- package/Meshes/Builders/latheBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.d.ts +0 -26
- package/Meshes/Builders/linesBuilder.js +0 -26
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Builders/planeBuilder.d.ts +0 -14
- package/Meshes/Builders/planeBuilder.js +0 -14
- package/Meshes/Builders/planeBuilder.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.d.ts +0 -21
- package/Meshes/Builders/polygonBuilder.js +0 -21
- package/Meshes/Builders/polygonBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.d.ts +0 -25
- package/Meshes/Builders/polyhedronBuilder.js +0 -25
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/ribbonBuilder.d.ts +0 -22
- package/Meshes/Builders/ribbonBuilder.js +0 -22
- package/Meshes/Builders/ribbonBuilder.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.d.ts +0 -32
- package/Meshes/Builders/shapeBuilder.js +0 -32
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/Builders/sphereBuilder.d.ts +0 -22
- package/Meshes/Builders/sphereBuilder.js +0 -22
- package/Meshes/Builders/sphereBuilder.js.map +1 -1
- package/Meshes/Node/Blocks/geometryDesaturateBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryDesaturateBlock.js +62 -0
- package/Meshes/Node/Blocks/geometryDesaturateBlock.js.map +1 -0
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/abstractMesh.js +1 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.js +4 -4
- package/Meshes/mesh.js.map +1 -1
- package/Physics/castingResult.d.ts +66 -0
- package/Physics/castingResult.js +61 -0
- package/Physics/castingResult.js.map +1 -0
- package/Physics/index.d.ts +4 -0
- package/Physics/index.js +4 -0
- package/Physics/index.js.map +1 -1
- package/Physics/physicsPointProximityQuery.d.ts +28 -0
- package/Physics/physicsPointProximityQuery.js +2 -0
- package/Physics/physicsPointProximityQuery.js.map +1 -0
- package/Physics/physicsRaycastResult.d.ts +2 -44
- package/Physics/physicsRaycastResult.js +7 -38
- package/Physics/physicsRaycastResult.js.map +1 -1
- package/Physics/physicsShapeCastQuery.d.ts +32 -0
- package/Physics/physicsShapeCastQuery.js +2 -0
- package/Physics/physicsShapeCastQuery.js.map +1 -0
- package/Physics/physicsShapeProximityCastQuery.d.ts +32 -0
- package/Physics/physicsShapeProximityCastQuery.js +2 -0
- package/Physics/physicsShapeProximityCastQuery.js.map +1 -0
- package/Physics/proximityCastResult.d.ts +20 -0
- package/Physics/proximityCastResult.js +31 -0
- package/Physics/proximityCastResult.js.map +1 -0
- package/Physics/shapeCastResult.d.ts +16 -0
- package/Physics/shapeCastResult.js +24 -0
- package/Physics/shapeCastResult.js.map +1 -0
- package/Physics/v2/Plugins/havokPlugin.d.ts +28 -0
- package/Physics/v2/Plugins/havokPlugin.js +80 -11
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +2 -2
- package/XR/features/WebXRHandTracking.js +4 -5
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +25 -15
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/webXRCamera.d.ts +1 -0
- package/XR/webXRCamera.js +19 -8
- package/XR/webXRCamera.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Vector3 } from "../Maths/math.vector";
|
|
2
|
+
import type { PhysicsShape } from "./v2";
|
|
3
|
+
import type { PhysicsBody } from "./v2/physicsBody";
|
|
4
|
+
/**
|
|
5
|
+
* Base class for results of casts.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CastingResult {
|
|
8
|
+
private _hasHit;
|
|
9
|
+
protected _hitNormal: Vector3;
|
|
10
|
+
protected _hitPoint: Vector3;
|
|
11
|
+
private _triangleIndex;
|
|
12
|
+
/**
|
|
13
|
+
* The Physics body that the query hit.
|
|
14
|
+
*/
|
|
15
|
+
body?: PhysicsBody;
|
|
16
|
+
/**
|
|
17
|
+
* The body Index in case the Physics body is using instances
|
|
18
|
+
*/
|
|
19
|
+
bodyIndex?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The shape hit by the query.
|
|
22
|
+
*/
|
|
23
|
+
shape?: PhysicsShape;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the hit point.
|
|
26
|
+
*/
|
|
27
|
+
get hitPoint(): Vector3;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the hit normal.
|
|
30
|
+
*/
|
|
31
|
+
get hitNormal(): Vector3;
|
|
32
|
+
/**
|
|
33
|
+
* Gets if there was a hit
|
|
34
|
+
*/
|
|
35
|
+
get hasHit(): boolean;
|
|
36
|
+
get triangleIndex(): number;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the hit data
|
|
39
|
+
* @param hitNormal defines the normal in world space
|
|
40
|
+
* @param hitPoint defines the point in world space
|
|
41
|
+
* @param triangleIndex defines the index of the triangle in case of mesh shape
|
|
42
|
+
*/
|
|
43
|
+
setHitData(hitNormal: IXYZ, hitPoint: IXYZ, triangleIndex?: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Resets all the values to default
|
|
46
|
+
*/
|
|
47
|
+
reset(): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Interface for the size containing width and height
|
|
51
|
+
*/
|
|
52
|
+
interface IXYZ {
|
|
53
|
+
/**
|
|
54
|
+
* X
|
|
55
|
+
*/
|
|
56
|
+
x: number;
|
|
57
|
+
/**
|
|
58
|
+
* Y
|
|
59
|
+
*/
|
|
60
|
+
y: number;
|
|
61
|
+
/**
|
|
62
|
+
* Z
|
|
63
|
+
*/
|
|
64
|
+
z: number;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Vector3 } from "../Maths/math.vector.js";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for results of casts.
|
|
4
|
+
*/
|
|
5
|
+
export class CastingResult {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._hasHit = false;
|
|
8
|
+
this._hitNormal = Vector3.Zero();
|
|
9
|
+
this._hitPoint = Vector3.Zero();
|
|
10
|
+
this._triangleIndex = -1;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Gets the hit point.
|
|
14
|
+
*/
|
|
15
|
+
get hitPoint() {
|
|
16
|
+
return this._hitPoint;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets the hit normal.
|
|
20
|
+
*/
|
|
21
|
+
get hitNormal() {
|
|
22
|
+
return this._hitNormal;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets if there was a hit
|
|
26
|
+
*/
|
|
27
|
+
get hasHit() {
|
|
28
|
+
return this._hasHit;
|
|
29
|
+
}
|
|
30
|
+
/*
|
|
31
|
+
* The index of the original triangle which was hit. Will be -1 if contact point is not on a mesh shape
|
|
32
|
+
*/
|
|
33
|
+
get triangleIndex() {
|
|
34
|
+
return this._triangleIndex;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sets the hit data
|
|
38
|
+
* @param hitNormal defines the normal in world space
|
|
39
|
+
* @param hitPoint defines the point in world space
|
|
40
|
+
* @param triangleIndex defines the index of the triangle in case of mesh shape
|
|
41
|
+
*/
|
|
42
|
+
setHitData(hitNormal, hitPoint, triangleIndex) {
|
|
43
|
+
this._hasHit = true;
|
|
44
|
+
this._hitNormal.set(hitNormal.x, hitNormal.y, hitNormal.z);
|
|
45
|
+
this._hitPoint.set(hitPoint.x, hitPoint.y, hitPoint.z);
|
|
46
|
+
this._triangleIndex = triangleIndex !== null && triangleIndex !== void 0 ? triangleIndex : -1;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resets all the values to default
|
|
50
|
+
*/
|
|
51
|
+
reset() {
|
|
52
|
+
this._hasHit = false;
|
|
53
|
+
this._hitNormal.setAll(0);
|
|
54
|
+
this._hitPoint.setAll(0);
|
|
55
|
+
this._triangleIndex = -1;
|
|
56
|
+
this.body = undefined;
|
|
57
|
+
this.bodyIndex = undefined;
|
|
58
|
+
this.shape = undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=castingResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"castingResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/castingResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI/C;;GAEG;AACH,MAAM,OAAO,aAAa;IAA1B;QACY,YAAO,GAAY,KAAK,CAAC;QACvB,eAAU,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QACrC,cAAS,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QACtC,mBAAc,GAAW,CAAC,CAAC,CAAC;IAsExC,CAAC;IAtDG;;OAEG;IACH,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,SAAe,EAAE,QAAc,EAAE,aAAsB;QACrE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,cAAc,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,KAAK;QACR,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;QAEzB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../Maths/math.vector\";\r\nimport type { PhysicsShape } from \"./v2\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\n\r\n/**\r\n * Base class for results of casts.\r\n */\r\nexport class CastingResult {\r\n private _hasHit: boolean = false;\r\n protected _hitNormal: Vector3 = Vector3.Zero();\r\n protected _hitPoint: Vector3 = Vector3.Zero();\r\n private _triangleIndex: number = -1;\r\n\r\n /**\r\n * The Physics body that the query hit.\r\n */\r\n public body?: PhysicsBody;\r\n /**\r\n * The body Index in case the Physics body is using instances\r\n */\r\n public bodyIndex?: number;\r\n\r\n /**\r\n * The shape hit by the query.\r\n */\r\n public shape?: PhysicsShape;\r\n\r\n /**\r\n * Gets the hit point.\r\n */\r\n get hitPoint(): Vector3 {\r\n return this._hitPoint;\r\n }\r\n /**\r\n * Gets the hit normal.\r\n */\r\n get hitNormal(): Vector3 {\r\n return this._hitNormal;\r\n }\r\n /**\r\n * Gets if there was a hit\r\n */\r\n get hasHit(): boolean {\r\n return this._hasHit;\r\n }\r\n\r\n /*\r\n * The index of the original triangle which was hit. Will be -1 if contact point is not on a mesh shape\r\n */\r\n get triangleIndex(): number {\r\n return this._triangleIndex;\r\n }\r\n\r\n /**\r\n * Sets the hit data\r\n * @param hitNormal defines the normal in world space\r\n * @param hitPoint defines the point in world space\r\n * @param triangleIndex defines the index of the triangle in case of mesh shape\r\n */\r\n public setHitData(hitNormal: IXYZ, hitPoint: IXYZ, triangleIndex?: number) {\r\n this._hasHit = true;\r\n this._hitNormal.set(hitNormal.x, hitNormal.y, hitNormal.z);\r\n this._hitPoint.set(hitPoint.x, hitPoint.y, hitPoint.z);\r\n this._triangleIndex = triangleIndex ?? -1;\r\n }\r\n\r\n /**\r\n * Resets all the values to default\r\n */\r\n public reset() {\r\n this._hasHit = false;\r\n\r\n this._hitNormal.setAll(0);\r\n this._hitPoint.setAll(0);\r\n this._triangleIndex = -1;\r\n\r\n this.body = undefined;\r\n this.bodyIndex = undefined;\r\n\r\n this.shape = undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Interface for the size containing width and height\r\n */\r\ninterface IXYZ {\r\n /**\r\n * X\r\n */\r\n x: number;\r\n\r\n /**\r\n * Y\r\n */\r\n y: number;\r\n\r\n /**\r\n * Z\r\n */\r\n z: number;\r\n}\r\n"]}
|
package/Physics/index.d.ts
CHANGED
|
@@ -4,3 +4,7 @@ export * from "./physicsEngineComponent";
|
|
|
4
4
|
export * from "./v1/physicsEngineComponent";
|
|
5
5
|
export * from "./physicsHelper";
|
|
6
6
|
export * from "./physicsRaycastResult";
|
|
7
|
+
export * from "./proximityCastResult";
|
|
8
|
+
export * from "./physicsPointProximityQuery";
|
|
9
|
+
export * from "./physicsShapeProximityCastQuery";
|
|
10
|
+
export * from "./shapeCastResult";
|
package/Physics/index.js
CHANGED
|
@@ -5,4 +5,8 @@ export * from "./physicsEngineComponent.js";
|
|
|
5
5
|
export * from "./v1/physicsEngineComponent.js";
|
|
6
6
|
export * from "./physicsHelper.js";
|
|
7
7
|
export * from "./physicsRaycastResult.js";
|
|
8
|
+
export * from "./proximityCastResult.js";
|
|
9
|
+
export * from "./physicsPointProximityQuery.js";
|
|
10
|
+
export * from "./physicsShapeProximityCastQuery.js";
|
|
11
|
+
export * from "./shapeCastResult.js";
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
package/Physics/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./v1/index\";\r\nexport * from \"./v2/index\";\r\nexport * from \"./physicsEngineComponent\";\r\nexport * from \"./v1/physicsEngineComponent\";\r\nexport * from \"./physicsHelper\";\r\nexport * from \"./physicsRaycastResult\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./v1/index\";\r\nexport * from \"./v2/index\";\r\nexport * from \"./physicsEngineComponent\";\r\nexport * from \"./v1/physicsEngineComponent\";\r\nexport * from \"./physicsHelper\";\r\nexport * from \"./physicsRaycastResult\";\r\nexport * from \"./proximityCastResult\";\r\nexport * from \"./physicsPointProximityQuery\";\r\nexport * from \"./physicsShapeProximityCastQuery\";\r\nexport * from \"./shapeCastResult\";\r\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Vector3 } from "../Maths/math.vector";
|
|
2
|
+
import type { IRaycastQuery } from "./physicsRaycastResult";
|
|
3
|
+
import type { PhysicsBody } from "./v2";
|
|
4
|
+
/**
|
|
5
|
+
* Interface for point proximity query.
|
|
6
|
+
*/
|
|
7
|
+
export interface IPhysicsPointProximityQuery {
|
|
8
|
+
/**
|
|
9
|
+
* The position of the query
|
|
10
|
+
*/
|
|
11
|
+
position: Vector3;
|
|
12
|
+
/**
|
|
13
|
+
* Maximum distance to check for collisions. Can be set to 0 to check for overlaps.
|
|
14
|
+
*/
|
|
15
|
+
maxDistance: number;
|
|
16
|
+
/**
|
|
17
|
+
* Collision filter for the query.
|
|
18
|
+
*/
|
|
19
|
+
collisionFilter: IRaycastQuery;
|
|
20
|
+
/**
|
|
21
|
+
* Should trigger collisions be considered in the query?
|
|
22
|
+
*/
|
|
23
|
+
shouldHitTriggers: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Should the query ignore the body that is passed in?
|
|
26
|
+
*/
|
|
27
|
+
ignoreBody?: PhysicsBody;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physicsPointProximityQuery.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsPointProximityQuery.ts"],"names":[],"mappings":"","sourcesContent":["import type { Vector3 } from \"../Maths/math.vector\";\r\nimport type { IRaycastQuery } from \"./physicsRaycastResult\";\r\nimport type { PhysicsBody } from \"./v2\";\r\n\r\n/**\r\n * Interface for point proximity query.\r\n */\r\nexport interface IPhysicsPointProximityQuery {\r\n /**\r\n * The position of the query\r\n */\r\n position: Vector3;\r\n /**\r\n * Maximum distance to check for collisions. Can be set to 0 to check for overlaps.\r\n */\r\n maxDistance: number;\r\n /**\r\n * Collision filter for the query.\r\n */\r\n collisionFilter: IRaycastQuery;\r\n /**\r\n * Should trigger collisions be considered in the query?\r\n */\r\n shouldHitTriggers: boolean;\r\n /**\r\n * Should the query ignore the body that is passed in?\r\n */\r\n ignoreBody?: PhysicsBody;\r\n}\r\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vector3 } from "../Maths/math.vector";
|
|
2
|
-
import
|
|
2
|
+
import { CastingResult } from "./castingResult";
|
|
3
3
|
/**
|
|
4
4
|
* Interface for query parameters in the raycast function.
|
|
5
5
|
* @see the "Collision Filtering" section in https://github.com/eoineoineoin/glTF/tree/MSFT_RigidBodies/extensions/2.0/Vendor/MSFT_collision_primitives
|
|
@@ -14,26 +14,10 @@ export interface IRaycastQuery {
|
|
|
14
14
|
* Holds the data for the raycast result
|
|
15
15
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
|
|
16
16
|
*/
|
|
17
|
-
export declare class PhysicsRaycastResult {
|
|
18
|
-
private _hasHit;
|
|
17
|
+
export declare class PhysicsRaycastResult extends CastingResult {
|
|
19
18
|
private _hitDistance;
|
|
20
|
-
private _hitNormalWorld;
|
|
21
|
-
private _hitPointWorld;
|
|
22
19
|
private _rayFromWorld;
|
|
23
20
|
private _rayToWorld;
|
|
24
|
-
private _triangleIndex;
|
|
25
|
-
/**
|
|
26
|
-
* The Physics body that the ray hit
|
|
27
|
-
*/
|
|
28
|
-
body?: PhysicsBody;
|
|
29
|
-
/**
|
|
30
|
-
* The body Index in case the Physics body is using instances
|
|
31
|
-
*/
|
|
32
|
-
bodyIndex?: number;
|
|
33
|
-
/**
|
|
34
|
-
* Gets if there was a hit
|
|
35
|
-
*/
|
|
36
|
-
get hasHit(): boolean;
|
|
37
21
|
/**
|
|
38
22
|
* Gets the distance from the hit
|
|
39
23
|
*/
|
|
@@ -54,14 +38,6 @@ export declare class PhysicsRaycastResult {
|
|
|
54
38
|
* Gets the ray "end point" of the ray in the world
|
|
55
39
|
*/
|
|
56
40
|
get rayToWorld(): Vector3;
|
|
57
|
-
get triangleIndex(): number;
|
|
58
|
-
/**
|
|
59
|
-
* Sets the hit data (normal & point in world space)
|
|
60
|
-
* @param hitNormalWorld defines the normal in world space
|
|
61
|
-
* @param hitPointWorld defines the point in world space
|
|
62
|
-
* @param triangleIndex defines the index of the triangle in case of mesh intersection
|
|
63
|
-
*/
|
|
64
|
-
setHitData(hitNormalWorld: IXYZ, hitPointWorld: IXYZ, triangleIndex?: number): void;
|
|
65
41
|
/**
|
|
66
42
|
* Sets the distance from the start point to the hit point
|
|
67
43
|
* @param distance defines the distance to set
|
|
@@ -78,21 +54,3 @@ export declare class PhysicsRaycastResult {
|
|
|
78
54
|
*/
|
|
79
55
|
reset(from?: Vector3, to?: Vector3): void;
|
|
80
56
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Interface for the size containing width and height
|
|
83
|
-
*/
|
|
84
|
-
interface IXYZ {
|
|
85
|
-
/**
|
|
86
|
-
* X
|
|
87
|
-
*/
|
|
88
|
-
x: number;
|
|
89
|
-
/**
|
|
90
|
-
* Y
|
|
91
|
-
*/
|
|
92
|
-
y: number;
|
|
93
|
-
/**
|
|
94
|
-
* Z
|
|
95
|
-
*/
|
|
96
|
-
z: number;
|
|
97
|
-
}
|
|
98
|
-
export {};
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { Vector3 } from "../Maths/math.vector.js";
|
|
2
|
+
import { CastingResult } from "./castingResult.js";
|
|
2
3
|
/**
|
|
3
4
|
* Holds the data for the raycast result
|
|
4
5
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
|
|
5
6
|
*/
|
|
6
|
-
export class PhysicsRaycastResult {
|
|
7
|
+
export class PhysicsRaycastResult extends CastingResult {
|
|
7
8
|
constructor() {
|
|
8
|
-
|
|
9
|
+
super(...arguments);
|
|
9
10
|
this._hitDistance = 0;
|
|
10
|
-
this._hitNormalWorld = Vector3.Zero();
|
|
11
|
-
this._hitPointWorld = Vector3.Zero();
|
|
12
11
|
this._rayFromWorld = Vector3.Zero();
|
|
13
12
|
this._rayToWorld = Vector3.Zero();
|
|
14
|
-
this._triangleIndex = -1;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Gets if there was a hit
|
|
18
|
-
*/
|
|
19
|
-
get hasHit() {
|
|
20
|
-
return this._hasHit;
|
|
21
13
|
}
|
|
22
14
|
/**
|
|
23
15
|
* Gets the distance from the hit
|
|
@@ -29,13 +21,13 @@ export class PhysicsRaycastResult {
|
|
|
29
21
|
* Gets the hit normal/direction in the world
|
|
30
22
|
*/
|
|
31
23
|
get hitNormalWorld() {
|
|
32
|
-
return this.
|
|
24
|
+
return this._hitNormal;
|
|
33
25
|
}
|
|
34
26
|
/**
|
|
35
27
|
* Gets the hit point in the world
|
|
36
28
|
*/
|
|
37
29
|
get hitPointWorld() {
|
|
38
|
-
return this.
|
|
30
|
+
return this._hitPoint;
|
|
39
31
|
}
|
|
40
32
|
/**
|
|
41
33
|
* Gets the ray "start point" of the ray in the world
|
|
@@ -49,24 +41,6 @@ export class PhysicsRaycastResult {
|
|
|
49
41
|
get rayToWorld() {
|
|
50
42
|
return this._rayToWorld;
|
|
51
43
|
}
|
|
52
|
-
/*
|
|
53
|
-
* The index of the original triangle which was hit. Will be -1 if contact point is not on a mesh shape
|
|
54
|
-
*/
|
|
55
|
-
get triangleIndex() {
|
|
56
|
-
return this._triangleIndex;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Sets the hit data (normal & point in world space)
|
|
60
|
-
* @param hitNormalWorld defines the normal in world space
|
|
61
|
-
* @param hitPointWorld defines the point in world space
|
|
62
|
-
* @param triangleIndex defines the index of the triangle in case of mesh intersection
|
|
63
|
-
*/
|
|
64
|
-
setHitData(hitNormalWorld, hitPointWorld, triangleIndex) {
|
|
65
|
-
this._hasHit = true;
|
|
66
|
-
this._hitNormalWorld.set(hitNormalWorld.x, hitNormalWorld.y, hitNormalWorld.z);
|
|
67
|
-
this._hitPointWorld.set(hitPointWorld.x, hitPointWorld.y, hitPointWorld.z);
|
|
68
|
-
this._triangleIndex = triangleIndex !== null && triangleIndex !== void 0 ? triangleIndex : -1;
|
|
69
|
-
}
|
|
70
44
|
/**
|
|
71
45
|
* Sets the distance from the start point to the hit point
|
|
72
46
|
* @param distance defines the distance to set
|
|
@@ -78,7 +52,7 @@ export class PhysicsRaycastResult {
|
|
|
78
52
|
* Calculates the distance manually
|
|
79
53
|
*/
|
|
80
54
|
calculateHitDistance() {
|
|
81
|
-
this._hitDistance = Vector3.Distance(this._rayFromWorld, this.
|
|
55
|
+
this._hitDistance = Vector3.Distance(this._rayFromWorld, this._hitPoint);
|
|
82
56
|
}
|
|
83
57
|
/**
|
|
84
58
|
* Resets all the values to default
|
|
@@ -86,15 +60,10 @@ export class PhysicsRaycastResult {
|
|
|
86
60
|
* @param to The to point on world space
|
|
87
61
|
*/
|
|
88
62
|
reset(from = Vector3.Zero(), to = Vector3.Zero()) {
|
|
63
|
+
super.reset();
|
|
89
64
|
this._rayFromWorld.copyFrom(from);
|
|
90
65
|
this._rayToWorld.copyFrom(to);
|
|
91
|
-
this._hasHit = false;
|
|
92
66
|
this._hitDistance = 0;
|
|
93
|
-
this._hitNormalWorld.setAll(0);
|
|
94
|
-
this._hitPointWorld.setAll(0);
|
|
95
|
-
this._triangleIndex = -1;
|
|
96
|
-
this.body = undefined;
|
|
97
|
-
this.bodyIndex = undefined;
|
|
98
67
|
}
|
|
99
68
|
}
|
|
100
69
|
//# sourceMappingURL=physicsRaycastResult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsRaycastResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsRaycastResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"physicsRaycastResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsRaycastResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAahD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IAAvD;;QACY,iBAAY,GAAW,CAAC,CAAC;QACzB,kBAAa,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QACxC,gBAAW,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;IAgElD,CAAC;IA9DG;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,QAAgB;QAClC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,oBAAoB;QACvB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAgB,OAAO,CAAC,IAAI,EAAE,EAAE,KAAc,OAAO,CAAC,IAAI,EAAE;QACrE,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAE9B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../Maths/math.vector\";\r\nimport { CastingResult } from \"./castingResult\";\r\n\r\n/**\r\n * Interface for query parameters in the raycast function.\r\n * @see the \"Collision Filtering\" section in https://github.com/eoineoineoin/glTF/tree/MSFT_RigidBodies/extensions/2.0/Vendor/MSFT_collision_primitives\r\n */\r\nexport interface IRaycastQuery {\r\n /** Membership mask */\r\n membership?: number;\r\n /** CollideWith mask */\r\n collideWith?: number;\r\n}\r\n\r\n/**\r\n * Holds the data for the raycast result\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsRaycastResult extends CastingResult {\r\n private _hitDistance: number = 0;\r\n private _rayFromWorld: Vector3 = Vector3.Zero();\r\n private _rayToWorld: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Gets the distance from the hit\r\n */\r\n get hitDistance(): number {\r\n return this._hitDistance;\r\n }\r\n\r\n /**\r\n * Gets the hit normal/direction in the world\r\n */\r\n get hitNormalWorld(): Vector3 {\r\n return this._hitNormal;\r\n }\r\n\r\n /**\r\n * Gets the hit point in the world\r\n */\r\n get hitPointWorld(): Vector3 {\r\n return this._hitPoint;\r\n }\r\n\r\n /**\r\n * Gets the ray \"start point\" of the ray in the world\r\n */\r\n get rayFromWorld(): Vector3 {\r\n return this._rayFromWorld;\r\n }\r\n\r\n /**\r\n * Gets the ray \"end point\" of the ray in the world\r\n */\r\n get rayToWorld(): Vector3 {\r\n return this._rayToWorld;\r\n }\r\n\r\n /**\r\n * Sets the distance from the start point to the hit point\r\n * @param distance defines the distance to set\r\n */\r\n public setHitDistance(distance: number) {\r\n this._hitDistance = distance;\r\n }\r\n\r\n /**\r\n * Calculates the distance manually\r\n */\r\n public calculateHitDistance() {\r\n this._hitDistance = Vector3.Distance(this._rayFromWorld, this._hitPoint);\r\n }\r\n\r\n /**\r\n * Resets all the values to default\r\n * @param from The from point on world space\r\n * @param to The to point on world space\r\n */\r\n public reset(from: Vector3 = Vector3.Zero(), to: Vector3 = Vector3.Zero()) {\r\n super.reset();\r\n this._rayFromWorld.copyFrom(from);\r\n this._rayToWorld.copyFrom(to);\r\n\r\n this._hitDistance = 0;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Quaternion, Vector3 } from "../Maths/math.vector";
|
|
2
|
+
import type { PhysicsShape } from "./v2/physicsShape";
|
|
3
|
+
import type { PhysicsBody } from "./v2/physicsBody";
|
|
4
|
+
/**
|
|
5
|
+
* Shape cast query
|
|
6
|
+
*/
|
|
7
|
+
export interface IPhysicsShapeCastQuery {
|
|
8
|
+
/**
|
|
9
|
+
* The shape to query with
|
|
10
|
+
*/
|
|
11
|
+
shape: PhysicsShape;
|
|
12
|
+
/**
|
|
13
|
+
* The rotation of the shape
|
|
14
|
+
*/
|
|
15
|
+
rotation: Quaternion;
|
|
16
|
+
/**
|
|
17
|
+
* The start position of the query
|
|
18
|
+
*/
|
|
19
|
+
startPosition: Vector3;
|
|
20
|
+
/**
|
|
21
|
+
* The end position of the query
|
|
22
|
+
*/
|
|
23
|
+
endPosition: Vector3;
|
|
24
|
+
/**
|
|
25
|
+
* Should trigger collisions be considered in the query?
|
|
26
|
+
*/
|
|
27
|
+
shouldHitTriggers: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Ignores the body passed if it is in the query
|
|
30
|
+
*/
|
|
31
|
+
ignoreBody?: PhysicsBody;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physicsShapeCastQuery.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsShapeCastQuery.ts"],"names":[],"mappings":"","sourcesContent":["import type { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\nimport type { PhysicsShape } from \"./v2/physicsShape\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\n\r\n/**\r\n * Shape cast query\r\n */\r\nexport interface IPhysicsShapeCastQuery {\r\n /**\r\n * The shape to query with\r\n */\r\n shape: PhysicsShape;\r\n /**\r\n * The rotation of the shape\r\n */\r\n rotation: Quaternion;\r\n /**\r\n * The start position of the query\r\n */\r\n startPosition: Vector3;\r\n /**\r\n * The end position of the query\r\n */\r\n endPosition: Vector3;\r\n /**\r\n * Should trigger collisions be considered in the query?\r\n */\r\n shouldHitTriggers: boolean;\r\n /**\r\n * Ignores the body passed if it is in the query\r\n */\r\n ignoreBody?: PhysicsBody;\r\n}\r\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Quaternion, Vector3 } from "../Maths/math.vector";
|
|
2
|
+
import type { PhysicsShape } from "./v2/physicsShape";
|
|
3
|
+
import type { PhysicsBody } from "./v2/physicsBody";
|
|
4
|
+
/**
|
|
5
|
+
* Query for shape proximity.
|
|
6
|
+
*/
|
|
7
|
+
export interface IPhysicsShapeProximityCastQuery {
|
|
8
|
+
/**
|
|
9
|
+
* The shape to test proximity against
|
|
10
|
+
*/
|
|
11
|
+
shape: PhysicsShape;
|
|
12
|
+
/**
|
|
13
|
+
* The position of shape
|
|
14
|
+
*/
|
|
15
|
+
position: Vector3;
|
|
16
|
+
/**
|
|
17
|
+
* The rotation of shape
|
|
18
|
+
*/
|
|
19
|
+
rotation: Quaternion;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum distance to check for collisions. Can be set to 0 to check for overlaps.
|
|
22
|
+
*/
|
|
23
|
+
maxDistance: number;
|
|
24
|
+
/**
|
|
25
|
+
* Should trigger collisions be considered in the query?
|
|
26
|
+
*/
|
|
27
|
+
shouldHitTriggers: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Ignores the body passed if it is in the query
|
|
30
|
+
*/
|
|
31
|
+
ignoreBody?: PhysicsBody;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physicsShapeProximityCastQuery.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsShapeProximityCastQuery.ts"],"names":[],"mappings":"","sourcesContent":["import type { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\nimport type { PhysicsShape } from \"./v2/physicsShape\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\n\r\n/**\r\n * Query for shape proximity.\r\n */\r\nexport interface IPhysicsShapeProximityCastQuery {\r\n /**\r\n * The shape to test proximity against\r\n */\r\n shape: PhysicsShape;\r\n /**\r\n * The position of shape\r\n */\r\n position: Vector3;\r\n /**\r\n * The rotation of shape\r\n */\r\n rotation: Quaternion;\r\n /**\r\n * Maximum distance to check for collisions. Can be set to 0 to check for overlaps.\r\n */\r\n maxDistance: number;\r\n /**\r\n * Should trigger collisions be considered in the query?\r\n */\r\n shouldHitTriggers: boolean;\r\n /**\r\n * Ignores the body passed if it is in the query\r\n */\r\n ignoreBody?: PhysicsBody;\r\n}\r\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CastingResult } from "./castingResult";
|
|
2
|
+
/**
|
|
3
|
+
* Class representing a contact point produced in a proximity cast
|
|
4
|
+
*/
|
|
5
|
+
export declare class ProximityCastResult extends CastingResult {
|
|
6
|
+
protected _hitDistance: number;
|
|
7
|
+
/**
|
|
8
|
+
* Gets the distance from the hit
|
|
9
|
+
*/
|
|
10
|
+
get hitDistance(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the distance from the start point to the hit point
|
|
13
|
+
* @param distance
|
|
14
|
+
*/
|
|
15
|
+
setHitDistance(distance: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* Resets all the values to default
|
|
18
|
+
*/
|
|
19
|
+
reset(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CastingResult } from "./castingResult.js";
|
|
2
|
+
/**
|
|
3
|
+
* Class representing a contact point produced in a proximity cast
|
|
4
|
+
*/
|
|
5
|
+
export class ProximityCastResult extends CastingResult {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this._hitDistance = 0;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Gets the distance from the hit
|
|
12
|
+
*/
|
|
13
|
+
get hitDistance() {
|
|
14
|
+
return this._hitDistance;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Sets the distance from the start point to the hit point
|
|
18
|
+
* @param distance
|
|
19
|
+
*/
|
|
20
|
+
setHitDistance(distance) {
|
|
21
|
+
this._hitDistance = distance;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resets all the values to default
|
|
25
|
+
*/
|
|
26
|
+
reset() {
|
|
27
|
+
super.reset();
|
|
28
|
+
this._hitDistance = 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=proximityCastResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proximityCastResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/proximityCastResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAAtD;;QACc,iBAAY,GAAW,CAAC,CAAC;IAwBvC,CAAC;IAtBG;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,QAAgB;QAClC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK;QACR,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import { CastingResult } from \"./castingResult\";\r\n\r\n/**\r\n * Class representing a contact point produced in a proximity cast\r\n */\r\nexport class ProximityCastResult extends CastingResult {\r\n protected _hitDistance: number = 0;\r\n\r\n /**\r\n * Gets the distance from the hit\r\n */\r\n get hitDistance(): number {\r\n return this._hitDistance;\r\n }\r\n\r\n /**\r\n * Sets the distance from the start point to the hit point\r\n * @param distance\r\n */\r\n public setHitDistance(distance: number) {\r\n this._hitDistance = distance;\r\n }\r\n\r\n /**\r\n * Resets all the values to default\r\n */\r\n public reset() {\r\n super.reset();\r\n this._hitDistance = 0;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CastingResult } from "./castingResult";
|
|
2
|
+
/**
|
|
3
|
+
* Class representing a contact point produced in a shape cast
|
|
4
|
+
*/
|
|
5
|
+
export declare class ShapeCastResult extends CastingResult {
|
|
6
|
+
private _hitFraction;
|
|
7
|
+
/**
|
|
8
|
+
* Gets the hit fraction along the casting ray
|
|
9
|
+
*/
|
|
10
|
+
get hitFraction(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the hit fraction along the casting ray
|
|
13
|
+
* @param fraction
|
|
14
|
+
*/
|
|
15
|
+
setHitFraction(fraction: number): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CastingResult } from "./castingResult.js";
|
|
2
|
+
/**
|
|
3
|
+
* Class representing a contact point produced in a shape cast
|
|
4
|
+
*/
|
|
5
|
+
export class ShapeCastResult extends CastingResult {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this._hitFraction = 0;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Gets the hit fraction along the casting ray
|
|
12
|
+
*/
|
|
13
|
+
get hitFraction() {
|
|
14
|
+
return this._hitFraction;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Sets the hit fraction along the casting ray
|
|
18
|
+
* @param fraction
|
|
19
|
+
*/
|
|
20
|
+
setHitFraction(fraction) {
|
|
21
|
+
this._hitFraction = fraction;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=shapeCastResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapeCastResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/shapeCastResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAAlD;;QACY,iBAAY,GAAW,CAAC,CAAC;IAgBrC,CAAC;IAdG;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,QAAgB;QAClC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;IACjC,CAAC;CACJ","sourcesContent":["import { CastingResult } from \"./castingResult\";\r\n\r\n/**\r\n * Class representing a contact point produced in a shape cast\r\n */\r\nexport class ShapeCastResult extends CastingResult {\r\n private _hitFraction: number = 0;\r\n\r\n /**\r\n * Gets the hit fraction along the casting ray\r\n */\r\n get hitFraction(): number {\r\n return this._hitFraction;\r\n }\r\n\r\n /**\r\n * Sets the hit fraction along the casting ray\r\n * @param fraction\r\n */\r\n public setHitFraction(fraction: number) {\r\n this._hitFraction = fraction;\r\n }\r\n}\r\n"]}
|
|
@@ -11,6 +11,11 @@ import type { TransformNode } from "../../../Meshes/transformNode";
|
|
|
11
11
|
import { Mesh } from "../../../Meshes/mesh";
|
|
12
12
|
import { Observable } from "../../../Misc/observable";
|
|
13
13
|
import type { Nullable } from "../../../types";
|
|
14
|
+
import type { IPhysicsPointProximityQuery } from "../../physicsPointProximityQuery";
|
|
15
|
+
import type { ProximityCastResult } from "../../proximityCastResult";
|
|
16
|
+
import type { IPhysicsShapeProximityCastQuery } from "../../physicsShapeProximityCastQuery";
|
|
17
|
+
import type { IPhysicsShapeCastQuery } from "../../physicsShapeCastQuery";
|
|
18
|
+
import type { ShapeCastResult } from "../../shapeCastResult";
|
|
14
19
|
declare class BodyPluginData {
|
|
15
20
|
constructor(bodyId: any);
|
|
16
21
|
hpBodyId: any;
|
|
@@ -42,6 +47,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
42
47
|
private _timeStep;
|
|
43
48
|
private _tmpVec3;
|
|
44
49
|
private _bodies;
|
|
50
|
+
private _shapes;
|
|
45
51
|
private _bodyBuffer;
|
|
46
52
|
private _bodyCollisionObservable;
|
|
47
53
|
private _constraintToBodyIdPair;
|
|
@@ -736,6 +742,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
736
742
|
* the Havok constraint, when it is no longer needed. This is important for avoiding memory leaks.
|
|
737
743
|
*/
|
|
738
744
|
disposeConstraint(constraint: PhysicsConstraint): void;
|
|
745
|
+
private _populateHitData;
|
|
739
746
|
/**
|
|
740
747
|
* Performs a raycast from a given start point to a given end point and stores the result in a given PhysicsRaycastResult object.
|
|
741
748
|
*
|
|
@@ -748,6 +755,27 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
748
755
|
* It then performs the raycast and stores the hit data in the PhysicsRaycastResult object.
|
|
749
756
|
*/
|
|
750
757
|
raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult, query?: IRaycastQuery): void;
|
|
758
|
+
/**
|
|
759
|
+
* Given a point, returns the closest physics
|
|
760
|
+
* body to that point.
|
|
761
|
+
* @param query the query to perform. @see IPhysicsPointProximityQuery
|
|
762
|
+
* @param result contact point on the hit shape, in world space
|
|
763
|
+
*/
|
|
764
|
+
pointProximity(query: IPhysicsPointProximityQuery, result: ProximityCastResult): void;
|
|
765
|
+
/**
|
|
766
|
+
* Given a shape in a specific position and orientation, returns the closest point to that shape.
|
|
767
|
+
* @param query the query to perform. @see IPhysicsShapeProximityCastQuery
|
|
768
|
+
* @param inputShapeResult contact point on input shape, in input shape space
|
|
769
|
+
* @param hitShapeResult contact point on hit shape, in world space
|
|
770
|
+
*/
|
|
771
|
+
shapeProximity(query: IPhysicsShapeProximityCastQuery, inputShapeResult: ProximityCastResult, hitShapeResult: ProximityCastResult): void;
|
|
772
|
+
/**
|
|
773
|
+
* Given a shape in a specific orientation, cast it from the start to end position specified by the query, and return the first hit.
|
|
774
|
+
* @param query the query to perform. @see IPhysicsShapeCastQuery
|
|
775
|
+
* @param inputShapeResult contact point on input shape, in input shape space
|
|
776
|
+
* @param hitShapeResult contact point on hit shape, in world space
|
|
777
|
+
*/
|
|
778
|
+
shapeCast(query: IPhysicsShapeCastQuery, inputShapeResult: ShapeCastResult, hitShapeResult: ShapeCastResult): void;
|
|
751
779
|
/**
|
|
752
780
|
* Return the collision observable for a particular physics body.
|
|
753
781
|
* @param body the physics body
|