@babylonjs/core 6.2.0 → 6.3.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/Engines/WebGPU/webgpuHardwareTexture.js +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/thinEngine.js +21 -4
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -6
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/gizmo.js +1 -0
- package/Gizmos/gizmo.js.map +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/triPlanarBlock.d.ts +4 -0
- package/Materials/Node/Blocks/triPlanarBlock.js +44 -6
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +2 -1
- package/Materials/PBR/pbrMaterial.js +3 -2
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +2 -2
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +6 -0
- package/Materials/Textures/baseTexture.js +8 -0
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +7 -0
- package/Materials/Textures/cubeTexture.js +25 -2
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/standardMaterial.d.ts +2 -1
- package/Materials/standardMaterial.js +3 -2
- package/Materials/standardMaterial.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +4 -0
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +19 -4
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/decorators.d.ts +5 -1
- package/Misc/decorators.js +12 -4
- package/Misc/decorators.js.map +1 -1
- package/Misc/error.d.ts +1 -1
- package/Misc/error.js.map +1 -1
- package/Misc/tools.d.ts +6 -6
- package/Misc/tools.js +17 -14
- package/Misc/tools.js.map +1 -1
- package/Physics/physicsRaycastResult.js +6 -6
- package/Physics/physicsRaycastResult.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +2 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +16 -1
- package/Physics/v2/Plugins/havokPlugin.js +43 -3
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsAggregate.d.ts +0 -50
- package/Physics/v2/physicsAggregate.js +3 -2
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +12 -0
- package/Physics/v2/physicsBody.js +17 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/assetContainer.d.ts +2 -3
- package/assetContainer.js +13 -4
- package/assetContainer.js.map +1 -1
- package/node.d.ts +8 -0
- package/node.js +23 -1
- package/node.js.map +1 -1
- package/package.json +1 -1
|
@@ -99,6 +99,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
99
99
|
* Initializes a physics body with the given position and orientation.
|
|
100
100
|
*
|
|
101
101
|
* @param body - The physics body to initialize.
|
|
102
|
+
* @param motionType - The motion type of the body.
|
|
102
103
|
* @param position - The position of the body.
|
|
103
104
|
* @param orientation - The orientation of the body.
|
|
104
105
|
* This code is useful for initializing a physics body with the given position and orientation.
|
|
@@ -348,6 +349,20 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
348
349
|
* same transformation.
|
|
349
350
|
*/
|
|
350
351
|
setPhysicsBodyTransformation(body: PhysicsBody, node: TransformNode): void;
|
|
352
|
+
/**
|
|
353
|
+
* Sets the gravity factor of a body
|
|
354
|
+
* @param body the physics body to set the gravity factor for
|
|
355
|
+
* @param factor the gravity factor
|
|
356
|
+
* @param instanceIndex the index of the instance in an instanced body
|
|
357
|
+
*/
|
|
358
|
+
setGravityFactor(body: PhysicsBody, factor: number, instanceIndex?: number): void;
|
|
359
|
+
/**
|
|
360
|
+
* Get the gravity factor of a body
|
|
361
|
+
* @param body the physics body to get the gravity factor from
|
|
362
|
+
* @param instanceIndex the index of the instance in an instanced body. If not specified, the gravity factor of the first instance will be returned.
|
|
363
|
+
* @returns the gravity factor
|
|
364
|
+
*/
|
|
365
|
+
getGravityFactor(body: PhysicsBody, instanceIndex?: number): number;
|
|
351
366
|
/**
|
|
352
367
|
* Disposes a physics body.
|
|
353
368
|
*
|
|
@@ -479,7 +494,7 @@ export declare class HavokPlugin implements IPhysicsEnginePluginV2 {
|
|
|
479
494
|
* @param body - The main body to which the constraint is applied.
|
|
480
495
|
* @param childBody - The body to which the constraint is applied.
|
|
481
496
|
* @param constraint - The constraint to be applied.
|
|
482
|
-
*
|
|
497
|
+
* @param instanceIndex - If this body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.
|
|
483
498
|
* @param childInstanceIndex - If the child body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.
|
|
484
499
|
*/
|
|
485
500
|
addConstraint(body: PhysicsBody, childBody: PhysicsBody, constraint: PhysicsConstraint, instanceIndex?: number, childInstanceIndex?: number): void;
|
|
@@ -274,6 +274,7 @@ export class HavokPlugin {
|
|
|
274
274
|
* Initializes a physics body with the given position and orientation.
|
|
275
275
|
*
|
|
276
276
|
* @param body - The physics body to initialize.
|
|
277
|
+
* @param motionType - The motion type of the body.
|
|
277
278
|
* @param position - The position of the body.
|
|
278
279
|
* @param orientation - The orientation of the body.
|
|
279
280
|
* This code is useful for initializing a physics body with the given position and orientation.
|
|
@@ -449,8 +450,21 @@ export class HavokPlugin {
|
|
|
449
450
|
const bodyTranslation = bodyTransform[0];
|
|
450
451
|
const bodyOrientation = bodyTransform[1];
|
|
451
452
|
const quat = TmpVectors.Quaternion[0];
|
|
452
|
-
transformNode.position.set(bodyTranslation[0], bodyTranslation[1], bodyTranslation[2]);
|
|
453
453
|
quat.set(bodyOrientation[0], bodyOrientation[1], bodyOrientation[2], bodyOrientation[3]);
|
|
454
|
+
const parent = transformNode.parent;
|
|
455
|
+
// transform position/orientation in parent space
|
|
456
|
+
if (parent && parent.absoluteRotationQuaternion) {
|
|
457
|
+
TmpVectors.Vector3[2].set(bodyTranslation[0], bodyTranslation[1], bodyTranslation[2]);
|
|
458
|
+
parent.absoluteRotationQuaternion.conjugateToRef(TmpVectors.Quaternion[1]);
|
|
459
|
+
quat.multiplyInPlace(TmpVectors.Quaternion[1]);
|
|
460
|
+
TmpVectors.Vector3[2].subtractToRef(parent.absolutePosition, TmpVectors.Vector3[0]);
|
|
461
|
+
const localPosition = TmpVectors.Vector3[1];
|
|
462
|
+
TmpVectors.Vector3[0].rotateByQuaternionToRef(TmpVectors.Quaternion[1], localPosition);
|
|
463
|
+
transformNode.position.set(localPosition.x, localPosition.y, localPosition.z); // use set so position._isDirty is true
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
transformNode.position.set(bodyTranslation[0], bodyTranslation[1], bodyTranslation[2]);
|
|
467
|
+
}
|
|
454
468
|
if (transformNode.rotationQuaternion) {
|
|
455
469
|
transformNode.rotationQuaternion.copyFrom(quat);
|
|
456
470
|
}
|
|
@@ -837,6 +851,27 @@ export class HavokPlugin {
|
|
|
837
851
|
this._hknp.HP_Body_SetQTransform(body._pluginData.hpBodyId, this._getTransformInfos(node));
|
|
838
852
|
}
|
|
839
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* Sets the gravity factor of a body
|
|
856
|
+
* @param body the physics body to set the gravity factor for
|
|
857
|
+
* @param factor the gravity factor
|
|
858
|
+
* @param instanceIndex the index of the instance in an instanced body
|
|
859
|
+
*/
|
|
860
|
+
setGravityFactor(body, factor, instanceIndex) {
|
|
861
|
+
this._applyToBodyOrInstances(body, (pluginRef) => {
|
|
862
|
+
this._hknp.HP_Body_SetGravityFactor(pluginRef.hpBodyId, factor);
|
|
863
|
+
}, instanceIndex);
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Get the gravity factor of a body
|
|
867
|
+
* @param body the physics body to get the gravity factor from
|
|
868
|
+
* @param instanceIndex the index of the instance in an instanced body. If not specified, the gravity factor of the first instance will be returned.
|
|
869
|
+
* @returns the gravity factor
|
|
870
|
+
*/
|
|
871
|
+
getGravityFactor(body, instanceIndex) {
|
|
872
|
+
const pluginRef = this._getPluginReference(body, instanceIndex);
|
|
873
|
+
return this._hknp.HP_Body_GetGravityFactor(pluginRef.hpBodyId)[1];
|
|
874
|
+
}
|
|
840
875
|
/**
|
|
841
876
|
* Disposes a physics body.
|
|
842
877
|
*
|
|
@@ -996,6 +1031,10 @@ export class HavokPlugin {
|
|
|
996
1031
|
* It then creates an array containing the position and orientation of the node and returns it.
|
|
997
1032
|
*/
|
|
998
1033
|
_getTransformInfos(node) {
|
|
1034
|
+
if (node.parent) {
|
|
1035
|
+
node.computeWorldMatrix();
|
|
1036
|
+
return [this._bVecToV3(node.absolutePosition), this._bQuatToV4(node.absoluteRotationQuaternion)];
|
|
1037
|
+
}
|
|
999
1038
|
let orientation = TmpVectors.Quaternion[0];
|
|
1000
1039
|
if (node.rotationQuaternion) {
|
|
1001
1040
|
orientation = node.rotationQuaternion;
|
|
@@ -1205,7 +1244,7 @@ export class HavokPlugin {
|
|
|
1205
1244
|
* @param body - The main body to which the constraint is applied.
|
|
1206
1245
|
* @param childBody - The body to which the constraint is applied.
|
|
1207
1246
|
* @param constraint - The constraint to be applied.
|
|
1208
|
-
*
|
|
1247
|
+
* @param instanceIndex - If this body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.
|
|
1209
1248
|
* @param childInstanceIndex - If the child body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.
|
|
1210
1249
|
*/
|
|
1211
1250
|
addConstraint(body, childBody, constraint, instanceIndex, childInstanceIndex) {
|
|
@@ -1269,7 +1308,7 @@ export class HavokPlugin {
|
|
|
1269
1308
|
*
|
|
1270
1309
|
*/
|
|
1271
1310
|
getAxisFriction(constraint, axis) {
|
|
1272
|
-
return this._hknp.
|
|
1311
|
+
return this._hknp.HP_Constraint_GetAxisFriction(constraint._pluginData, this._constraintAxisToNative(axis))[1];
|
|
1273
1312
|
}
|
|
1274
1313
|
/**
|
|
1275
1314
|
* Sets the limit mode of the specified axis of the given constraint.
|
|
@@ -1424,6 +1463,7 @@ export class HavokPlugin {
|
|
|
1424
1463
|
raycast(from, to, result) {
|
|
1425
1464
|
const queryMembership = ~0;
|
|
1426
1465
|
const queryCollideWith = ~0;
|
|
1466
|
+
result.reset(from, to);
|
|
1427
1467
|
const query = [this._bVecToV3(from), this._bVecToV3(to), [queryMembership, queryCollideWith]];
|
|
1428
1468
|
this._hknp.HP_World_CastRayWithCollector(this.world, this._queryCollector, query);
|
|
1429
1469
|
if (this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1] > 0) {
|