@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
|
@@ -157,7 +157,7 @@ class ShapePath
|
|
|
157
157
|
public pathData: number;
|
|
158
158
|
}
|
|
159
159
|
*/
|
|
160
|
-
class
|
|
160
|
+
class CollisionContactPoint {
|
|
161
161
|
constructor() {
|
|
162
162
|
this.bodyId = BigInt(0); //0,2
|
|
163
163
|
//public colliderId: number = 0; //2,4
|
|
@@ -169,8 +169,8 @@ class ContactPoint {
|
|
|
169
169
|
}
|
|
170
170
|
class CollisionEvent {
|
|
171
171
|
constructor() {
|
|
172
|
-
this.contactOnA = new
|
|
173
|
-
this.contactOnB = new
|
|
172
|
+
this.contactOnA = new CollisionContactPoint(); //1
|
|
173
|
+
this.contactOnB = new CollisionContactPoint();
|
|
174
174
|
this.impulseApplied = 0;
|
|
175
175
|
this.type = 0;
|
|
176
176
|
}
|
|
@@ -222,6 +222,7 @@ export class HavokPlugin {
|
|
|
222
222
|
this._timeStep = 1 / 60;
|
|
223
223
|
this._tmpVec3 = ArrayTools.BuildArray(3, Vector3.Zero);
|
|
224
224
|
this._bodies = new Map();
|
|
225
|
+
this._shapes = new Map();
|
|
225
226
|
this._bodyCollisionObservable = new Map();
|
|
226
227
|
// Map from constraint id to the pair of bodies, where the first is the parent and the second is the child
|
|
227
228
|
this._constraintToBodyIdPair = new Map();
|
|
@@ -1070,6 +1071,7 @@ export class HavokPlugin {
|
|
|
1070
1071
|
throw new Error("Unsupported Shape Type.");
|
|
1071
1072
|
break;
|
|
1072
1073
|
}
|
|
1074
|
+
this._shapes.set(shape._pluginData[0], shape);
|
|
1073
1075
|
}
|
|
1074
1076
|
/**
|
|
1075
1077
|
* Sets the shape filter membership mask of a body
|
|
@@ -1694,6 +1696,17 @@ export class HavokPlugin {
|
|
|
1694
1696
|
}
|
|
1695
1697
|
constraint._pluginData.length = 0;
|
|
1696
1698
|
}
|
|
1699
|
+
_populateHitData(hitData, result) {
|
|
1700
|
+
const hitBody = this._bodies.get(hitData[0][0]);
|
|
1701
|
+
result.body = hitBody === null || hitBody === void 0 ? void 0 : hitBody.body;
|
|
1702
|
+
result.bodyIndex = hitBody === null || hitBody === void 0 ? void 0 : hitBody.index;
|
|
1703
|
+
const hitShape = this._shapes.get(hitData[1][0]);
|
|
1704
|
+
result.shape = hitShape;
|
|
1705
|
+
const hitPos = hitData[3];
|
|
1706
|
+
const hitNormal = hitData[4];
|
|
1707
|
+
const hitTriangle = hitData[5];
|
|
1708
|
+
result.setHitData({ x: hitNormal[0], y: hitNormal[1], z: hitNormal[2] }, { x: hitPos[0], y: hitPos[1], z: hitPos[2] }, hitTriangle);
|
|
1709
|
+
}
|
|
1697
1710
|
/**
|
|
1698
1711
|
* Performs a raycast from a given start point to a given end point and stores the result in a given PhysicsRaycastResult object.
|
|
1699
1712
|
*
|
|
@@ -1715,15 +1728,71 @@ export class HavokPlugin {
|
|
|
1715
1728
|
const hkQuery = [this._bVecToV3(from), this._bVecToV3(to), [queryMembership, queryCollideWith], shouldHitTriggers, bodyToIgnore];
|
|
1716
1729
|
this._hknp.HP_World_CastRayWithCollector(this.world, this._queryCollector, hkQuery);
|
|
1717
1730
|
if (this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1] > 0) {
|
|
1718
|
-
const hitData = this._hknp.HP_QueryCollector_GetCastRayResult(this._queryCollector, 0)[1];
|
|
1719
|
-
|
|
1720
|
-
const hitNormal = hitData[1][4];
|
|
1721
|
-
const hitTriangle = hitData[1][5];
|
|
1722
|
-
result.setHitData({ x: hitNormal[0], y: hitNormal[1], z: hitNormal[2] }, { x: hitPos[0], y: hitPos[1], z: hitPos[2] }, hitTriangle);
|
|
1731
|
+
const [, hitData] = this._hknp.HP_QueryCollector_GetCastRayResult(this._queryCollector, 0)[1];
|
|
1732
|
+
this._populateHitData(hitData, result);
|
|
1723
1733
|
result.calculateHitDistance();
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
/**
|
|
1737
|
+
* Given a point, returns the closest physics
|
|
1738
|
+
* body to that point.
|
|
1739
|
+
* @param query the query to perform. @see IPhysicsPointProximityQuery
|
|
1740
|
+
* @param result contact point on the hit shape, in world space
|
|
1741
|
+
*/
|
|
1742
|
+
pointProximity(query, result) {
|
|
1743
|
+
var _a, _b, _c, _d;
|
|
1744
|
+
const queryMembership = (_b = (_a = query === null || query === void 0 ? void 0 : query.collisionFilter) === null || _a === void 0 ? void 0 : _a.membership) !== null && _b !== void 0 ? _b : ~0;
|
|
1745
|
+
const queryCollideWith = (_d = (_c = query === null || query === void 0 ? void 0 : query.collisionFilter) === null || _c === void 0 ? void 0 : _c.collideWith) !== null && _d !== void 0 ? _d : ~0;
|
|
1746
|
+
result.reset();
|
|
1747
|
+
const bodyToIgnore = query.ignoreBody ? [BigInt(query.ignoreBody._pluginData.hpBodyId[0])] : [BigInt(0)];
|
|
1748
|
+
const hkQuery = [this._bVecToV3(query.position), query.maxDistance, [queryMembership, queryCollideWith], query.shouldHitTriggers, bodyToIgnore];
|
|
1749
|
+
this._hknp.HP_World_PointProximityWithCollector(this.world, this._queryCollector, hkQuery);
|
|
1750
|
+
if (this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1] > 0) {
|
|
1751
|
+
const [distance, hitData] = this._hknp.HP_QueryCollector_GetPointProximityResult(this._queryCollector, 0)[1];
|
|
1752
|
+
this._populateHitData(hitData, result);
|
|
1753
|
+
result.setHitDistance(distance);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Given a shape in a specific position and orientation, returns the closest point to that shape.
|
|
1758
|
+
* @param query the query to perform. @see IPhysicsShapeProximityCastQuery
|
|
1759
|
+
* @param inputShapeResult contact point on input shape, in input shape space
|
|
1760
|
+
* @param hitShapeResult contact point on hit shape, in world space
|
|
1761
|
+
*/
|
|
1762
|
+
shapeProximity(query, inputShapeResult, hitShapeResult) {
|
|
1763
|
+
inputShapeResult.reset();
|
|
1764
|
+
hitShapeResult.reset();
|
|
1765
|
+
const shapeId = query.shape._pluginData;
|
|
1766
|
+
const bodyToIgnore = query.ignoreBody ? [BigInt(query.ignoreBody._pluginData.hpBodyId[0])] : [BigInt(0)];
|
|
1767
|
+
const hkQuery = [shapeId, this._bVecToV3(query.position), this._bQuatToV4(query.rotation), query.maxDistance, query.shouldHitTriggers, bodyToIgnore];
|
|
1768
|
+
this._hknp.HP_World_ShapeProximityWithCollector(this.world, this._queryCollector, hkQuery);
|
|
1769
|
+
if (this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1] > 0) {
|
|
1770
|
+
const [distance, hitInputData, hitShapeData] = this._hknp.HP_QueryCollector_GetShapeProximityResult(this._queryCollector, 0)[1];
|
|
1771
|
+
this._populateHitData(hitInputData, inputShapeResult);
|
|
1772
|
+
this._populateHitData(hitShapeData, hitShapeResult);
|
|
1773
|
+
inputShapeResult.setHitDistance(distance);
|
|
1774
|
+
hitShapeResult.setHitDistance(distance);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Given a shape in a specific orientation, cast it from the start to end position specified by the query, and return the first hit.
|
|
1779
|
+
* @param query the query to perform. @see IPhysicsShapeCastQuery
|
|
1780
|
+
* @param inputShapeResult contact point on input shape, in input shape space
|
|
1781
|
+
* @param hitShapeResult contact point on hit shape, in world space
|
|
1782
|
+
*/
|
|
1783
|
+
shapeCast(query, inputShapeResult, hitShapeResult) {
|
|
1784
|
+
inputShapeResult.reset();
|
|
1785
|
+
hitShapeResult.reset();
|
|
1786
|
+
const shapeId = query.shape._pluginData;
|
|
1787
|
+
const bodyToIgnore = query.ignoreBody ? [BigInt(query.ignoreBody._pluginData.hpBodyId[0])] : [BigInt(0)];
|
|
1788
|
+
const hkQuery = [shapeId, this._bQuatToV4(query.rotation), this._bVecToV3(query.startPosition), this._bVecToV3(query.endPosition), query.shouldHitTriggers, bodyToIgnore];
|
|
1789
|
+
this._hknp.HP_World_ShapeCastWithCollector(this.world, this._queryCollector, hkQuery);
|
|
1790
|
+
if (this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1] > 0) {
|
|
1791
|
+
const [fractionAlongRay, hitInputData, hitShapeData] = this._hknp.HP_QueryCollector_GetShapeCastResult(this._queryCollector, 0)[1];
|
|
1792
|
+
this._populateHitData(hitInputData, inputShapeResult);
|
|
1793
|
+
this._populateHitData(hitShapeData, hitShapeResult);
|
|
1794
|
+
inputShapeResult.setHitFraction(fractionAlongRay);
|
|
1795
|
+
hitShapeResult.setHitFraction(fractionAlongRay);
|
|
1727
1796
|
}
|
|
1728
1797
|
}
|
|
1729
1798
|
/**
|