@babylonjs/core 6.18.0 → 6.19.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/animation.d.ts +2 -1
- package/Animations/animation.js +3 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.d.ts +26 -5
- package/Animations/animationGroup.js +101 -11
- package/Animations/animationGroup.js.map +1 -1
- package/Audio/sound.d.ts +1 -0
- package/Audio/sound.js +2 -1
- package/Audio/sound.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.d.ts +2 -0
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +9 -2
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.d.ts +9 -0
- package/DeviceInput/webDeviceInputSystem.js +22 -0
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/WebGL/webGLHardwareTexture.d.ts +1 -0
- package/Engines/WebGL/webGLHardwareTexture.js +4 -0
- package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +4 -3
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/renderTargetWrapper.js +3 -0
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +2 -2
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/directionalLight.js +3 -3
- package/Lights/directionalLight.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +3 -3
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +8 -3
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +4 -4
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.d.ts +2 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +2 -2
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.d.ts +3 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +21 -4
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +4 -4
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/index.d.ts +1 -0
- package/Materials/Node/Blocks/Fragment/index.js +1 -0
- package/Materials/Node/Blocks/Fragment/index.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.d.ts +31 -0
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js +87 -0
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -0
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/index.d.ts +1 -0
- package/Materials/Node/Blocks/Input/index.js +1 -0
- package/Materials/Node/Blocks/Input/index.js.map +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +62 -0
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js +135 -0
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +4 -4
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +2 -2
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +2 -2
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +4 -4
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +6 -6
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +5 -5
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.d.ts +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.js +2 -2
- package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +27 -1
- package/Materials/Node/nodeMaterial.js +96 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.d.ts +2 -1
- package/Materials/Node/nodeMaterialBlock.js +2 -1
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +6 -0
- package/Materials/Node/nodeMaterialBuildState.js +9 -0
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.d.ts +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +3 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +4 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +17 -4
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +4 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +17 -4
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +4 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +17 -4
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +9 -5
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInputBlock.js +3 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.d.ts +52 -0
- package/Meshes/Node/Blocks/mappingBlock.js +151 -0
- package/Meshes/Node/Blocks/mappingBlock.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/Node/nodeGeometryBlock.js +1 -0
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +4 -0
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +4 -0
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.d.ts +2 -0
- package/Meshes/Node/nodeGeometryBuildState.js +6 -0
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Particles/pointsCloudSystem.js +4 -3
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +9 -7
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +21 -8
- package/Physics/v2/Plugins/havokPlugin.js +139 -29
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsAggregate.js +4 -0
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +12 -2
- package/Physics/v2/physicsBody.js +19 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsConstraint.d.ts +15 -14
- package/Physics/v2/physicsConstraint.js +7 -7
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +6 -0
- package/Rendering/prePassRenderer.js +16 -3
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +1 -0
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockDirectLighting.js +1 -0
- package/Shaders/ShadersInclude/pbrBlockDirectLighting.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +2 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/Shaders/background.fragment.js +1 -1
- package/Shaders/background.fragment.js.map +1 -1
- package/Shaders/default.fragment.js +2 -2
- package/Shaders/default.fragment.js.map +1 -1
- package/XR/webXRCamera.d.ts +5 -0
- package/XR/webXRCamera.js +9 -0
- package/XR/webXRCamera.js.map +1 -1
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
44
44
|
private _bodies;
|
|
45
45
|
private _bodyBuffer;
|
|
46
46
|
private _bodyCollisionObservable;
|
|
47
|
+
private _bodyCollisionEndedObservable;
|
|
47
48
|
/**
|
|
48
49
|
* Observable for collision started and collision continued events
|
|
49
50
|
*/
|
|
@@ -568,7 +569,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
568
569
|
* @returns The friction value of the specified axis.
|
|
569
570
|
*
|
|
570
571
|
*/
|
|
571
|
-
getAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number
|
|
572
|
+
getAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;
|
|
572
573
|
/**
|
|
573
574
|
* Sets the limit mode of the specified axis of the given constraint.
|
|
574
575
|
* @param constraint - The constraint to set the axis mode of.
|
|
@@ -584,7 +585,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
584
585
|
* @returns The axis limit mode of the given constraint.
|
|
585
586
|
*
|
|
586
587
|
*/
|
|
587
|
-
getAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): PhysicsConstraintAxisLimitMode
|
|
588
|
+
getAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintAxisLimitMode>;
|
|
588
589
|
/**
|
|
589
590
|
* Sets the minimum limit of the given axis of the given constraint.
|
|
590
591
|
* @param constraint - The constraint to set the minimum limit of.
|
|
@@ -600,7 +601,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
600
601
|
* @returns The minimum limit of the specified axis of the given constraint.
|
|
601
602
|
*
|
|
602
603
|
*/
|
|
603
|
-
getAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number
|
|
604
|
+
getAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;
|
|
604
605
|
/**
|
|
605
606
|
* Sets the maximum limit of the given axis of the given constraint.
|
|
606
607
|
* @param constraint - The constraint to set the maximum limit of the given axis.
|
|
@@ -617,7 +618,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
617
618
|
* @returns The maximum limit of the given axis of the given constraint.
|
|
618
619
|
*
|
|
619
620
|
*/
|
|
620
|
-
getAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number
|
|
621
|
+
getAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;
|
|
621
622
|
/**
|
|
622
623
|
* Sets the motor type of the given axis of the given constraint.
|
|
623
624
|
* @param constraint - The constraint to set the motor type of.
|
|
@@ -634,7 +635,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
634
635
|
* @returns The motor type of the specified axis of the given constraint.
|
|
635
636
|
*
|
|
636
637
|
*/
|
|
637
|
-
getAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): PhysicsConstraintMotorType
|
|
638
|
+
getAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintMotorType>;
|
|
638
639
|
/**
|
|
639
640
|
* Sets the target of an axis motor of a constraint.
|
|
640
641
|
*
|
|
@@ -652,7 +653,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
652
653
|
* @returns The target of the motor of the given axis of the given constraint.
|
|
653
654
|
*
|
|
654
655
|
*/
|
|
655
|
-
getAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number
|
|
656
|
+
getAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;
|
|
656
657
|
/**
|
|
657
658
|
* Sets the maximum force that can be applied by the motor of the given constraint axis.
|
|
658
659
|
* @param constraint - The constraint to set the motor max force for.
|
|
@@ -669,7 +670,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
669
670
|
* @returns The maximum force of the motor of the given constraint axis.
|
|
670
671
|
*
|
|
671
672
|
*/
|
|
672
|
-
getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): number
|
|
673
|
+
getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;
|
|
673
674
|
/**
|
|
674
675
|
* Disposes a physics constraint.
|
|
675
676
|
*
|
|
@@ -697,11 +698,23 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
697
698
|
*/
|
|
698
699
|
getCollisionObservable(body: PhysicsBody): Observable<IPhysicsCollisionEvent>;
|
|
699
700
|
/**
|
|
700
|
-
*
|
|
701
|
+
* Return the collision ended observable for a particular physics body.
|
|
702
|
+
* @param body the physics body
|
|
703
|
+
* @returns
|
|
704
|
+
*/
|
|
705
|
+
getCollisionEndedObservable(body: PhysicsBody): Observable<IBasePhysicsCollisionEvent>;
|
|
706
|
+
/**
|
|
707
|
+
* Enable collision to be reported for a body when a callback is setup on the world
|
|
701
708
|
* @param body the physics body
|
|
702
709
|
* @param enabled
|
|
703
710
|
*/
|
|
704
711
|
setCollisionCallbackEnabled(body: PhysicsBody, enabled: boolean): void;
|
|
712
|
+
/**
|
|
713
|
+
* Enable collision ended to be reported for a body when a callback is setup on the world
|
|
714
|
+
* @param body
|
|
715
|
+
* @param enabled
|
|
716
|
+
*/
|
|
717
|
+
setCollisionEndedCallbackEnabled(body: PhysicsBody, enabled: boolean): void;
|
|
705
718
|
private _notifyTriggers;
|
|
706
719
|
/**
|
|
707
720
|
* Runs thru all detected collisions and filter by body
|
|
@@ -219,6 +219,7 @@ export class HavokPlugin {
|
|
|
219
219
|
this._tmpVec3 = ArrayTools.BuildArray(3, Vector3.Zero);
|
|
220
220
|
this._bodies = new Map();
|
|
221
221
|
this._bodyCollisionObservable = new Map();
|
|
222
|
+
this._bodyCollisionEndedObservable = new Map();
|
|
222
223
|
/**
|
|
223
224
|
* Observable for collision started and collision continued events
|
|
224
225
|
*/
|
|
@@ -1216,7 +1217,7 @@ export class HavokPlugin {
|
|
|
1216
1217
|
* This function is useful for setting up a physics constraint in a physics engine.
|
|
1217
1218
|
*/
|
|
1218
1219
|
initConstraint(constraint, body, childBody, instanceIndex, childInstanceIndex) {
|
|
1219
|
-
var _a, _b, _c, _d;
|
|
1220
|
+
var _a, _b, _c, _d, _e;
|
|
1220
1221
|
const type = constraint.type;
|
|
1221
1222
|
const options = constraint.options;
|
|
1222
1223
|
if (!type || !options) {
|
|
@@ -1227,8 +1228,9 @@ export class HavokPlugin {
|
|
|
1227
1228
|
Logger.Warn("Body is instanced but no instance index was specified. Constraint will not be applied.");
|
|
1228
1229
|
return;
|
|
1229
1230
|
}
|
|
1231
|
+
constraint._pluginData = (_a = constraint._pluginData) !== null && _a !== void 0 ? _a : [];
|
|
1230
1232
|
const jointId = this._hknp.HP_Constraint_Create()[1];
|
|
1231
|
-
constraint._pluginData
|
|
1233
|
+
constraint._pluginData.push(jointId);
|
|
1232
1234
|
// body parenting
|
|
1233
1235
|
const bodyA = this._getPluginReference(body, instanceIndex).hpBodyId;
|
|
1234
1236
|
const bodyB = this._getPluginReference(childBody, childInstanceIndex).hpBodyId;
|
|
@@ -1236,7 +1238,7 @@ export class HavokPlugin {
|
|
|
1236
1238
|
this._hknp.HP_Constraint_SetChildBody(jointId, bodyB);
|
|
1237
1239
|
// anchors
|
|
1238
1240
|
const pivotA = options.pivotA ? this._bVecToV3(options.pivotA) : this._bVecToV3(Vector3.Zero());
|
|
1239
|
-
const axisA = (
|
|
1241
|
+
const axisA = (_b = options.axisA) !== null && _b !== void 0 ? _b : new Vector3(1, 0, 0);
|
|
1240
1242
|
const perpAxisA = this._tmpVec3[0];
|
|
1241
1243
|
if (options.perpAxisA) {
|
|
1242
1244
|
perpAxisA.copyFrom(options.perpAxisA);
|
|
@@ -1246,7 +1248,7 @@ export class HavokPlugin {
|
|
|
1246
1248
|
}
|
|
1247
1249
|
this._hknp.HP_Constraint_SetAnchorInParent(jointId, pivotA, this._bVecToV3(axisA), this._bVecToV3(perpAxisA));
|
|
1248
1250
|
const pivotB = options.pivotB ? this._bVecToV3(options.pivotB) : this._bVecToV3(Vector3.Zero());
|
|
1249
|
-
const axisB = (
|
|
1251
|
+
const axisB = (_c = options.axisB) !== null && _c !== void 0 ? _c : new Vector3(1, 0, 0);
|
|
1250
1252
|
const perpAxisB = this._tmpVec3[0];
|
|
1251
1253
|
if (options.perpAxisB) {
|
|
1252
1254
|
perpAxisB.copyFrom(options.perpAxisB);
|
|
@@ -1299,7 +1301,7 @@ export class HavokPlugin {
|
|
|
1299
1301
|
const sixdofData = constraint;
|
|
1300
1302
|
for (const l of sixdofData.limits) {
|
|
1301
1303
|
const axId = this._constraintAxisToNative(l.axis);
|
|
1302
|
-
if (((
|
|
1304
|
+
if (((_d = l.minLimit) !== null && _d !== void 0 ? _d : -1) == 0 && ((_e = l.maxLimit) !== null && _e !== void 0 ? _e : -1) == 0) {
|
|
1303
1305
|
this._hknp.HP_Constraint_SetAxisMode(jointId, axId, this._hknp.ConstraintAxisLimitMode.LOCKED);
|
|
1304
1306
|
}
|
|
1305
1307
|
else {
|
|
@@ -1347,7 +1349,9 @@ export class HavokPlugin {
|
|
|
1347
1349
|
*
|
|
1348
1350
|
*/
|
|
1349
1351
|
setEnabled(constraint, isEnabled) {
|
|
1350
|
-
|
|
1352
|
+
for (const jointId of constraint._pluginData) {
|
|
1353
|
+
this._hknp.HP_Constraint_SetEnabled(jointId, isEnabled);
|
|
1354
|
+
}
|
|
1351
1355
|
}
|
|
1352
1356
|
/**
|
|
1353
1357
|
* Gets the enabled state of the given constraint.
|
|
@@ -1356,7 +1360,11 @@ export class HavokPlugin {
|
|
|
1356
1360
|
*
|
|
1357
1361
|
*/
|
|
1358
1362
|
getEnabled(constraint) {
|
|
1359
|
-
|
|
1363
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1364
|
+
if (firstId) {
|
|
1365
|
+
return this._hknp.HP_Constraint_GetEnabled(firstId)[1];
|
|
1366
|
+
}
|
|
1367
|
+
return false;
|
|
1360
1368
|
}
|
|
1361
1369
|
/**
|
|
1362
1370
|
* Enables or disables collisions for the given constraint.
|
|
@@ -1365,7 +1373,9 @@ export class HavokPlugin {
|
|
|
1365
1373
|
*
|
|
1366
1374
|
*/
|
|
1367
1375
|
setCollisionsEnabled(constraint, isEnabled) {
|
|
1368
|
-
|
|
1376
|
+
for (const jointId of constraint._pluginData) {
|
|
1377
|
+
this._hknp.HP_Constraint_SetCollisionsEnabled(jointId, isEnabled);
|
|
1378
|
+
}
|
|
1369
1379
|
}
|
|
1370
1380
|
/**
|
|
1371
1381
|
* Gets whether collisions are enabled for the given constraint.
|
|
@@ -1374,7 +1384,11 @@ export class HavokPlugin {
|
|
|
1374
1384
|
*
|
|
1375
1385
|
*/
|
|
1376
1386
|
getCollisionsEnabled(constraint) {
|
|
1377
|
-
|
|
1387
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1388
|
+
if (firstId) {
|
|
1389
|
+
return this._hknp.HP_Constraint_GetCollisionsEnabled(firstId)[1];
|
|
1390
|
+
}
|
|
1391
|
+
return false;
|
|
1378
1392
|
}
|
|
1379
1393
|
/**
|
|
1380
1394
|
* Sets the friction of the given axis of the given constraint.
|
|
@@ -1386,7 +1400,9 @@ export class HavokPlugin {
|
|
|
1386
1400
|
*
|
|
1387
1401
|
*/
|
|
1388
1402
|
setAxisFriction(constraint, axis, friction) {
|
|
1389
|
-
|
|
1403
|
+
for (const jointId of constraint._pluginData) {
|
|
1404
|
+
this._hknp.HP_Constraint_SetAxisFriction(jointId, this._constraintAxisToNative(axis), friction);
|
|
1405
|
+
}
|
|
1390
1406
|
}
|
|
1391
1407
|
/**
|
|
1392
1408
|
* Gets the friction value of the specified axis of the given constraint.
|
|
@@ -1397,7 +1413,11 @@ export class HavokPlugin {
|
|
|
1397
1413
|
*
|
|
1398
1414
|
*/
|
|
1399
1415
|
getAxisFriction(constraint, axis) {
|
|
1400
|
-
|
|
1416
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1417
|
+
if (firstId) {
|
|
1418
|
+
return this._hknp.HP_Constraint_GetAxisFriction(firstId, this._constraintAxisToNative(axis))[1];
|
|
1419
|
+
}
|
|
1420
|
+
return null;
|
|
1401
1421
|
}
|
|
1402
1422
|
/**
|
|
1403
1423
|
* Sets the limit mode of the specified axis of the given constraint.
|
|
@@ -1406,7 +1426,9 @@ export class HavokPlugin {
|
|
|
1406
1426
|
* @param limitMode - The limit mode to set.
|
|
1407
1427
|
*/
|
|
1408
1428
|
setAxisMode(constraint, axis, limitMode) {
|
|
1409
|
-
|
|
1429
|
+
for (const jointId of constraint._pluginData) {
|
|
1430
|
+
this._hknp.HP_Constraint_SetAxisMode(jointId, this._constraintAxisToNative(axis), this._limitModeToNative(limitMode));
|
|
1431
|
+
}
|
|
1410
1432
|
}
|
|
1411
1433
|
/**
|
|
1412
1434
|
* Gets the axis limit mode of the given constraint.
|
|
@@ -1417,8 +1439,12 @@ export class HavokPlugin {
|
|
|
1417
1439
|
*
|
|
1418
1440
|
*/
|
|
1419
1441
|
getAxisMode(constraint, axis) {
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1442
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1443
|
+
if (firstId) {
|
|
1444
|
+
const mode = this._hknp.HP_Constraint_GetAxisMode(firstId, this._constraintAxisToNative(axis))[1];
|
|
1445
|
+
return this._nativeToLimitMode(mode);
|
|
1446
|
+
}
|
|
1447
|
+
return null;
|
|
1422
1448
|
}
|
|
1423
1449
|
/**
|
|
1424
1450
|
* Sets the minimum limit of the given axis of the given constraint.
|
|
@@ -1428,7 +1454,9 @@ export class HavokPlugin {
|
|
|
1428
1454
|
*
|
|
1429
1455
|
*/
|
|
1430
1456
|
setAxisMinLimit(constraint, axis, limit) {
|
|
1431
|
-
|
|
1457
|
+
for (const jointId of constraint._pluginData) {
|
|
1458
|
+
this._hknp.HP_Constraint_SetAxisMinLimit(jointId, this._constraintAxisToNative(axis), limit);
|
|
1459
|
+
}
|
|
1432
1460
|
}
|
|
1433
1461
|
/**
|
|
1434
1462
|
* Gets the minimum limit of the specified axis of the given constraint.
|
|
@@ -1438,7 +1466,11 @@ export class HavokPlugin {
|
|
|
1438
1466
|
*
|
|
1439
1467
|
*/
|
|
1440
1468
|
getAxisMinLimit(constraint, axis) {
|
|
1441
|
-
|
|
1469
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1470
|
+
if (firstId) {
|
|
1471
|
+
return this._hknp.HP_Constraint_GetAxisMinLimit(firstId, this._constraintAxisToNative(axis))[1];
|
|
1472
|
+
}
|
|
1473
|
+
return null;
|
|
1442
1474
|
}
|
|
1443
1475
|
/**
|
|
1444
1476
|
* Sets the maximum limit of the given axis of the given constraint.
|
|
@@ -1448,7 +1480,9 @@ export class HavokPlugin {
|
|
|
1448
1480
|
*
|
|
1449
1481
|
*/
|
|
1450
1482
|
setAxisMaxLimit(constraint, axis, limit) {
|
|
1451
|
-
|
|
1483
|
+
for (const jointId of constraint._pluginData) {
|
|
1484
|
+
this._hknp.HP_Constraint_SetAxisMaxLimit(jointId, this._constraintAxisToNative(axis), limit);
|
|
1485
|
+
}
|
|
1452
1486
|
}
|
|
1453
1487
|
/**
|
|
1454
1488
|
* Gets the maximum limit of the given axis of the given constraint.
|
|
@@ -1459,7 +1493,11 @@ export class HavokPlugin {
|
|
|
1459
1493
|
*
|
|
1460
1494
|
*/
|
|
1461
1495
|
getAxisMaxLimit(constraint, axis) {
|
|
1462
|
-
|
|
1496
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1497
|
+
if (firstId) {
|
|
1498
|
+
return this._hknp.HP_Constraint_GetAxisMaxLimit(firstId, this._constraintAxisToNative(axis))[1];
|
|
1499
|
+
}
|
|
1500
|
+
return null;
|
|
1463
1501
|
}
|
|
1464
1502
|
/**
|
|
1465
1503
|
* Sets the motor type of the given axis of the given constraint.
|
|
@@ -1470,7 +1508,9 @@ export class HavokPlugin {
|
|
|
1470
1508
|
*
|
|
1471
1509
|
*/
|
|
1472
1510
|
setAxisMotorType(constraint, axis, motorType) {
|
|
1473
|
-
|
|
1511
|
+
for (const jointId of constraint._pluginData) {
|
|
1512
|
+
this._hknp.HP_Constraint_SetAxisMotorType(jointId, this._constraintAxisToNative(axis), this._constraintMotorTypeToNative(motorType));
|
|
1513
|
+
}
|
|
1474
1514
|
}
|
|
1475
1515
|
/**
|
|
1476
1516
|
* Gets the motor type of the specified axis of the given constraint.
|
|
@@ -1480,7 +1520,11 @@ export class HavokPlugin {
|
|
|
1480
1520
|
*
|
|
1481
1521
|
*/
|
|
1482
1522
|
getAxisMotorType(constraint, axis) {
|
|
1483
|
-
|
|
1523
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1524
|
+
if (firstId) {
|
|
1525
|
+
return this._nativeToMotorType(this._hknp.HP_Constraint_GetAxisMotorType(firstId, this._constraintAxisToNative(axis))[1]);
|
|
1526
|
+
}
|
|
1527
|
+
return null;
|
|
1484
1528
|
}
|
|
1485
1529
|
/**
|
|
1486
1530
|
* Sets the target of an axis motor of a constraint.
|
|
@@ -1491,7 +1535,9 @@ export class HavokPlugin {
|
|
|
1491
1535
|
*
|
|
1492
1536
|
*/
|
|
1493
1537
|
setAxisMotorTarget(constraint, axis, target) {
|
|
1494
|
-
|
|
1538
|
+
for (const jointId of constraint._pluginData) {
|
|
1539
|
+
this._hknp.HP_Constraint_SetAxisMotorTarget(jointId, this._constraintAxisToNative(axis), target);
|
|
1540
|
+
}
|
|
1495
1541
|
}
|
|
1496
1542
|
/**
|
|
1497
1543
|
* Gets the target of the motor of the given axis of the given constraint.
|
|
@@ -1502,7 +1548,11 @@ export class HavokPlugin {
|
|
|
1502
1548
|
*
|
|
1503
1549
|
*/
|
|
1504
1550
|
getAxisMotorTarget(constraint, axis) {
|
|
1505
|
-
|
|
1551
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1552
|
+
if (firstId) {
|
|
1553
|
+
return this._hknp.HP_Constraint_GetAxisMotorTarget(constraint._pluginData, this._constraintAxisToNative(axis))[1];
|
|
1554
|
+
}
|
|
1555
|
+
return null;
|
|
1506
1556
|
}
|
|
1507
1557
|
/**
|
|
1508
1558
|
* Sets the maximum force that can be applied by the motor of the given constraint axis.
|
|
@@ -1512,7 +1562,9 @@ export class HavokPlugin {
|
|
|
1512
1562
|
*
|
|
1513
1563
|
*/
|
|
1514
1564
|
setAxisMotorMaxForce(constraint, axis, maxForce) {
|
|
1515
|
-
|
|
1565
|
+
for (const jointId of constraint._pluginData) {
|
|
1566
|
+
this._hknp.HP_Constraint_SetAxisMotorMaxForce(jointId, this._constraintAxisToNative(axis), maxForce);
|
|
1567
|
+
}
|
|
1516
1568
|
}
|
|
1517
1569
|
/**
|
|
1518
1570
|
* Gets the maximum force of the motor of the given constraint axis.
|
|
@@ -1523,7 +1575,11 @@ export class HavokPlugin {
|
|
|
1523
1575
|
*
|
|
1524
1576
|
*/
|
|
1525
1577
|
getAxisMotorMaxForce(constraint, axis) {
|
|
1526
|
-
|
|
1578
|
+
const firstId = constraint._pluginData && constraint._pluginData[0];
|
|
1579
|
+
if (firstId) {
|
|
1580
|
+
return this._hknp.HP_Constraint_GetAxisMotorMaxForce(firstId, this._constraintAxisToNative(axis))[1];
|
|
1581
|
+
}
|
|
1582
|
+
return null;
|
|
1527
1583
|
}
|
|
1528
1584
|
/**
|
|
1529
1585
|
* Disposes a physics constraint.
|
|
@@ -1534,10 +1590,11 @@ export class HavokPlugin {
|
|
|
1534
1590
|
* the Havok constraint, when it is no longer needed. This is important for avoiding memory leaks.
|
|
1535
1591
|
*/
|
|
1536
1592
|
disposeConstraint(constraint) {
|
|
1537
|
-
const jointId
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1593
|
+
for (const jointId of constraint._pluginData) {
|
|
1594
|
+
this._hknp.HP_Constraint_SetEnabled(jointId, false);
|
|
1595
|
+
this._hknp.HP_Constraint_Release(jointId);
|
|
1596
|
+
}
|
|
1597
|
+
constraint._pluginData.length = 0;
|
|
1541
1598
|
}
|
|
1542
1599
|
/**
|
|
1543
1600
|
* Performs a raycast from a given start point to a given end point and stores the result in a given PhysicsRaycastResult object.
|
|
@@ -1583,7 +1640,21 @@ export class HavokPlugin {
|
|
|
1583
1640
|
return observable;
|
|
1584
1641
|
}
|
|
1585
1642
|
/**
|
|
1586
|
-
*
|
|
1643
|
+
* Return the collision ended observable for a particular physics body.
|
|
1644
|
+
* @param body the physics body
|
|
1645
|
+
* @returns
|
|
1646
|
+
*/
|
|
1647
|
+
getCollisionEndedObservable(body) {
|
|
1648
|
+
const bodyId = body._pluginData.hpBodyId[0];
|
|
1649
|
+
let observable = this._bodyCollisionEndedObservable.get(bodyId);
|
|
1650
|
+
if (!observable) {
|
|
1651
|
+
observable = new Observable();
|
|
1652
|
+
this._bodyCollisionEndedObservable.set(bodyId, observable);
|
|
1653
|
+
}
|
|
1654
|
+
return observable;
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Enable collision to be reported for a body when a callback is setup on the world
|
|
1587
1658
|
* @param body the physics body
|
|
1588
1659
|
* @param enabled
|
|
1589
1660
|
*/
|
|
@@ -1599,6 +1670,28 @@ export class HavokPlugin {
|
|
|
1599
1670
|
this._hknp.HP_Body_SetEventMask(body._pluginData.hpBodyId, enabled ? collideEvents : 0);
|
|
1600
1671
|
}
|
|
1601
1672
|
}
|
|
1673
|
+
/**
|
|
1674
|
+
* Enable collision ended to be reported for a body when a callback is setup on the world
|
|
1675
|
+
* @param body
|
|
1676
|
+
* @param enabled
|
|
1677
|
+
*/
|
|
1678
|
+
setCollisionEndedCallbackEnabled(body, enabled) {
|
|
1679
|
+
// Register to collide ended events
|
|
1680
|
+
const pluginRef = this._getPluginReference(body);
|
|
1681
|
+
let currentCollideEvents = this._hknp.HP_Body_GetEventMask(pluginRef.hpBodyId)[1];
|
|
1682
|
+
// update with the ended mask
|
|
1683
|
+
currentCollideEvents = enabled
|
|
1684
|
+
? currentCollideEvents | this._hknp.EventType.COLLISION_FINISHED.value
|
|
1685
|
+
: currentCollideEvents & ~this._hknp.EventType.COLLISION_FINISHED.value;
|
|
1686
|
+
if (body._pluginDataInstances && body._pluginDataInstances.length) {
|
|
1687
|
+
body._pluginDataInstances.forEach((bodyId) => {
|
|
1688
|
+
this._hknp.HP_Body_SetEventMask(bodyId.hpBodyId, currentCollideEvents);
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
else if (body._pluginData) {
|
|
1692
|
+
this._hknp.HP_Body_SetEventMask(body._pluginData.hpBodyId, currentCollideEvents);
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1602
1695
|
_notifyTriggers() {
|
|
1603
1696
|
let eventAddress = this._hknp.HP_World_GetTriggerEvents(this.world)[1];
|
|
1604
1697
|
const event = new TriggerEvent();
|
|
@@ -1664,6 +1757,23 @@ export class HavokPlugin {
|
|
|
1664
1757
|
observableB.notifyObservers(collisionInfo);
|
|
1665
1758
|
}
|
|
1666
1759
|
}
|
|
1760
|
+
else if (this._bodyCollisionEndedObservable.size) {
|
|
1761
|
+
const observableA = this._bodyCollisionEndedObservable.get(event.contactOnA.bodyId);
|
|
1762
|
+
const observableB = this._bodyCollisionEndedObservable.get(event.contactOnB.bodyId);
|
|
1763
|
+
if (observableA) {
|
|
1764
|
+
observableA.notifyObservers(collisionInfo);
|
|
1765
|
+
}
|
|
1766
|
+
else if (observableB) {
|
|
1767
|
+
//<todo This seems like it would give unexpected results when both bodies have observers?
|
|
1768
|
+
// Flip collision info:
|
|
1769
|
+
collisionInfo.collider = bodyInfoB.body;
|
|
1770
|
+
collisionInfo.colliderIndex = bodyInfoB.index;
|
|
1771
|
+
collisionInfo.collidedAgainst = bodyInfoA.body;
|
|
1772
|
+
collisionInfo.collidedAgainstIndex = bodyInfoA.index;
|
|
1773
|
+
collisionInfo.normal = event.contactOnB.normal;
|
|
1774
|
+
observableB.notifyObservers(collisionInfo);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1667
1777
|
eventAddress = this._hknp.HP_World_GetNextCollisionEvent(worldAddr, eventAddress);
|
|
1668
1778
|
}
|
|
1669
1779
|
}
|