gdcore-tools 2.0.0-gd-v5.4.220-autobuild → 2.0.0-gd-v5.5.222-autobuild
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Runtime/Extensions/3D/JsExtension.js +3 -3
- package/dist/Runtime/Extensions/DialogueTree/bondage.js/dist/bondage.d.ts +39 -0
- package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js +2 -2
- package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js.map +2 -2
- package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +4 -2
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/JsExtension.js +64 -10
- package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/jolt-physics.d.ts +283 -5
- package/dist/Runtime/Extensions/Physics3DBehavior/jolt-physics.wasm.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/jolt-physics.wasm.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/jolt-physics.wasm.wasm +0 -0
- package/dist/Runtime/Extensions/TextInput/JsExtension.js +110 -8
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
- package/dist/Runtime/events-tools/soundtools.js +1 -1
- package/dist/Runtime/events-tools/soundtools.js.map +2 -2
- package/dist/Runtime/types/project-data.d.ts +0 -1
- package/dist/lib/libGD.cjs +1 -1
- package/dist/lib/libGD.wasm +0 -0
- package/dist/loaders.cjs +3 -3
- package/gd.d.ts +44 -24
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
|
20
20
|
extension
|
|
21
21
|
.setExtensionInformation(
|
|
22
22
|
'Physics3D',
|
|
23
|
-
_('3D
|
|
23
|
+
_('3D physics engine'),
|
|
24
24
|
"The physics engine simulates realistic object physics, with gravity, forces, joints, etc. It's perfect for games that need to have realistic behaving objects and a gameplay centered around it.",
|
|
25
25
|
'Florian Rival',
|
|
26
26
|
'MIT'
|
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
|
29
29
|
.setCategory('Movement')
|
|
30
30
|
.setTags('physics, gravity, obstacle, collision');
|
|
31
31
|
extension
|
|
32
|
-
.addInstructionOrExpressionGroupMetadata(_('3D
|
|
32
|
+
.addInstructionOrExpressionGroupMetadata(_('3D physics engine'))
|
|
33
33
|
.setIcon('JsPlatform/Extensions/physics3d.svg');
|
|
34
34
|
{
|
|
35
35
|
const behavior = new gd.BehaviorJsImplementation();
|
|
@@ -300,7 +300,8 @@ module.exports = {
|
|
|
300
300
|
_(
|
|
301
301
|
'The friction applied when touching other objects. The higher the value, the more friction.'
|
|
302
302
|
)
|
|
303
|
-
)
|
|
303
|
+
)
|
|
304
|
+
.setGroup(_('Movement'));
|
|
304
305
|
behaviorProperties
|
|
305
306
|
.getOrCreate('restitution')
|
|
306
307
|
.setValue(
|
|
@@ -315,7 +316,8 @@ module.exports = {
|
|
|
315
316
|
_(
|
|
316
317
|
'The "bounciness" of the object. The higher the value, the more other objects will bounce against it.'
|
|
317
318
|
)
|
|
318
|
-
)
|
|
319
|
+
)
|
|
320
|
+
.setGroup(_('Movement'));
|
|
319
321
|
behaviorProperties
|
|
320
322
|
.getOrCreate('linearDamping')
|
|
321
323
|
.setValue(
|
|
@@ -996,8 +998,8 @@ module.exports = {
|
|
|
996
998
|
'number',
|
|
997
999
|
'AngularVelocityX',
|
|
998
1000
|
_('Angular velocity X'),
|
|
999
|
-
_('the object angular velocity
|
|
1000
|
-
_('the angular velocity
|
|
1001
|
+
_('the object angular velocity around X.'),
|
|
1002
|
+
_('the angular velocity around X'),
|
|
1001
1003
|
_('Velocity'),
|
|
1002
1004
|
'JsPlatform/Extensions/physics3d.svg'
|
|
1003
1005
|
)
|
|
@@ -1017,8 +1019,8 @@ module.exports = {
|
|
|
1017
1019
|
'number',
|
|
1018
1020
|
'AngularVelocityY',
|
|
1019
1021
|
_('Angular velocity Y'),
|
|
1020
|
-
_('the object angular velocity
|
|
1021
|
-
_('the angular velocity
|
|
1022
|
+
_('the object angular velocity around Y.'),
|
|
1023
|
+
_('the angular velocity around Y'),
|
|
1022
1024
|
_('Velocity'),
|
|
1023
1025
|
'JsPlatform/Extensions/physics3d.svg'
|
|
1024
1026
|
)
|
|
@@ -1038,8 +1040,8 @@ module.exports = {
|
|
|
1038
1040
|
'number',
|
|
1039
1041
|
'AngularVelocityZ',
|
|
1040
1042
|
_('Angular velocity Z'),
|
|
1041
|
-
_('the object angular velocity
|
|
1042
|
-
_('the angular velocity
|
|
1043
|
+
_('the object angular velocity around Z.'),
|
|
1044
|
+
_('the angular velocity around Z'),
|
|
1043
1045
|
_('Velocity'),
|
|
1044
1046
|
'JsPlatform/Extensions/physics3d.svg'
|
|
1045
1047
|
)
|
|
@@ -1533,6 +1535,15 @@ module.exports = {
|
|
|
1533
1535
|
return true;
|
|
1534
1536
|
}
|
|
1535
1537
|
|
|
1538
|
+
if (propertyName === 'stairHeightMax') {
|
|
1539
|
+
const newValueAsNumber = parseFloat(newValue);
|
|
1540
|
+
if (newValueAsNumber !== newValueAsNumber) return false;
|
|
1541
|
+
behaviorContent
|
|
1542
|
+
.getChild('stairHeightMax')
|
|
1543
|
+
.setDoubleValue(newValueAsNumber);
|
|
1544
|
+
return true;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1536
1547
|
if (propertyName === 'shouldBindObjectAndForwardAngle') {
|
|
1537
1548
|
behaviorContent
|
|
1538
1549
|
.getChild('shouldBindObjectAndForwardAngle')
|
|
@@ -1540,6 +1551,13 @@ module.exports = {
|
|
|
1540
1551
|
return true;
|
|
1541
1552
|
}
|
|
1542
1553
|
|
|
1554
|
+
if (propertyName === 'canBePushed') {
|
|
1555
|
+
behaviorContent
|
|
1556
|
+
.getChild('canBePushed')
|
|
1557
|
+
.setBoolValue(newValue === '1');
|
|
1558
|
+
return true;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1543
1561
|
return false;
|
|
1544
1562
|
};
|
|
1545
1563
|
behavior.getProperties = function (behaviorContent) {
|
|
@@ -1701,6 +1719,24 @@ module.exports = {
|
|
|
1701
1719
|
.setAdvanced(true)
|
|
1702
1720
|
.setQuickCustomizationVisibility(gd.QuickCustomization.Hidden);
|
|
1703
1721
|
|
|
1722
|
+
if (!behaviorContent.hasChild('stairHeightMax')) {
|
|
1723
|
+
behaviorContent.addChild('stairHeightMax').setDoubleValue(20);
|
|
1724
|
+
}
|
|
1725
|
+
behaviorProperties
|
|
1726
|
+
.getOrCreate('stairHeightMax')
|
|
1727
|
+
.setLabel('Max. stair height')
|
|
1728
|
+
.setGroup(_('Walk'))
|
|
1729
|
+
.setType('Number')
|
|
1730
|
+
.setMeasurementUnit(gd.MeasurementUnit.getPixel())
|
|
1731
|
+
.setValue(
|
|
1732
|
+
behaviorContent
|
|
1733
|
+
.getChild('stairHeightMax')
|
|
1734
|
+
.getDoubleValue()
|
|
1735
|
+
.toString(10)
|
|
1736
|
+
)
|
|
1737
|
+
.setAdvanced(true)
|
|
1738
|
+
.setQuickCustomizationVisibility(gd.QuickCustomization.Hidden);
|
|
1739
|
+
|
|
1704
1740
|
behaviorProperties
|
|
1705
1741
|
.getOrCreate('shouldBindObjectAndForwardAngle')
|
|
1706
1742
|
.setLabel('Keep object angle and forward direction the same')
|
|
@@ -1716,6 +1752,22 @@ module.exports = {
|
|
|
1716
1752
|
.setAdvanced(true)
|
|
1717
1753
|
.setQuickCustomizationVisibility(gd.QuickCustomization.Hidden);
|
|
1718
1754
|
|
|
1755
|
+
if (!behaviorContent.hasChild('canBePushed')) {
|
|
1756
|
+
behaviorContent.addChild('canBePushed').setBoolValue(true);
|
|
1757
|
+
}
|
|
1758
|
+
behaviorProperties
|
|
1759
|
+
.getOrCreate('canBePushed')
|
|
1760
|
+
.setLabel('Can be pushed by other characters')
|
|
1761
|
+
.setGroup(_('Walk'))
|
|
1762
|
+
.setType('Boolean')
|
|
1763
|
+
.setValue(
|
|
1764
|
+
behaviorContent.getChild('canBePushed').getBoolValue()
|
|
1765
|
+
? 'true'
|
|
1766
|
+
: 'false'
|
|
1767
|
+
)
|
|
1768
|
+
.setAdvanced(true)
|
|
1769
|
+
.setQuickCustomizationVisibility(gd.QuickCustomization.Hidden);
|
|
1770
|
+
|
|
1719
1771
|
return behaviorProperties;
|
|
1720
1772
|
};
|
|
1721
1773
|
|
|
@@ -1732,9 +1784,11 @@ module.exports = {
|
|
|
1732
1784
|
behaviorContent.addChild('sidewaysDeceleration').setDoubleValue(800);
|
|
1733
1785
|
behaviorContent.addChild('sidewaysSpeedMax').setDoubleValue(400);
|
|
1734
1786
|
behaviorContent.addChild('slopeMaxAngle').setDoubleValue(50);
|
|
1787
|
+
behaviorContent.addChild('stairHeightMax').setDoubleValue(20);
|
|
1735
1788
|
behaviorContent
|
|
1736
1789
|
.addChild('shouldBindObjectAndForwardAngle')
|
|
1737
1790
|
.setBoolValue(true);
|
|
1791
|
+
behaviorContent.addChild('canBePushed').setBoolValue(true);
|
|
1738
1792
|
};
|
|
1739
1793
|
|
|
1740
1794
|
const aut = extension
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(n){const g=async()=>{try{const t=(await import("./jolt-physics.wasm.js")).default;if(!t)throw new Error("No default export found in Jolt.");const e=await t();window.Jolt=e}catch(u){throw console.error("Unable to load Jolt physics library.",u),u}};n.registerAsynchronouslyLoadingLibraryPromise(g());class b{constructor(t,e){this._tempVec3=new Jolt.Vec3;this._tempRVec3=new Jolt.RVec3;this._tempQuat=new Jolt.Quat;this.stepped=!1;this._physics3DHooks=[];this._registeredBehaviors=new Set,this.gravityX=e.gravityX,this.gravityY=e.gravityY,this.gravityZ=e.gravityZ,this.worldScale=e.worldScale,this.worldInvScale=1/this.worldScale;const i=new Jolt.JoltSettings;n.Physics3DSharedData.setupCollisionFiltering(i),this.jolt=new Jolt.JoltInterface(i),Jolt.destroy(i),this.physicsSystem=this.jolt.GetPhysicsSystem(),this.physicsSystem.SetGravity(this.getVec3(this.gravityX,this.gravityY,this.gravityZ)),this.bodyInterface=this.physicsSystem.GetBodyInterface(),this.contactListener=new Jolt.ContactListenerJS,this.physicsSystem.SetContactListener(this.contactListener),this.contactListener.OnContactAdded=(s,o,a,h)=>{const d=Jolt.wrapPointer(s,Jolt.Body),l=Jolt.wrapPointer(o,Jolt.Body),r=d.gdjsAssociatedBehavior,f=l.gdjsAssociatedBehavior;!r||!f||(r.onContactBegin(f),f.onContactBegin(r))},this.contactListener.OnContactRemoved=s=>{const o=Jolt.wrapPointer(s,Jolt.SubShapeIDPair),a=this.physicsSystem.GetBodyLockInterface(),h=a.TryGetBody(o.GetBody1ID()),d=a.TryGetBody(o.GetBody2ID()),l=h.gdjsAssociatedBehavior,r=d.gdjsAssociatedBehavior;!l||!r||(l.onContactEnd(r),r.onContactEnd(l))},this.contactListener.OnContactPersisted=(s,o,a,h)=>{},this.contactListener.OnContactValidate=(s,o,a,h)=>Jolt.ValidateResult_AcceptAllContactsForThisBodyPair}getVec3(t,e,i){const s=this._tempVec3;return s.Set(t,e,i),s}getRVec3(t,e,i){const s=this._tempRVec3;return s.Set(t,e,i),s}getQuat(t,e,i,s){const o=this._tempQuat;return o.Set(t,e,i,s),o}static getSharedData(t,e){if(!t.physics3DSharedData){const i=t.getInitialSharedDataForBehavior(e);t.physics3DSharedData=new n.Physics3DSharedData(t,i)}return t.physics3DSharedData}static setupCollisionFiltering(t){const e=new Jolt.ObjectLayerPairFilterMask,i=new Jolt.BroadPhaseLayer(n.Physics3DSharedData.staticBroadPhaseLayerIndex),s=new Jolt.BroadPhaseLayer(n.Physics3DSharedData.dynamicBroadPhaseLayerIndex),o=new Jolt.BroadPhaseLayerInterfaceMask(2);o.ConfigureLayer(i,n.Physics3DSharedData.staticLayersMask,0),o.ConfigureLayer(s,n.Physics3DSharedData.dynamicLayersMask,0),Jolt.destroy(i),Jolt.destroy(s),t.mObjectLayerPairFilter=e,t.mBroadPhaseLayerInterface=o,t.mObjectVsBroadPhaseLayerFilter=new Jolt.ObjectVsBroadPhaseLayerFilterMask(o)}addToBehaviorsList(t){this._registeredBehaviors.add(t)}removeFromBehaviorsList(t){this._registeredBehaviors.delete(t)}step(t){for(const i of this._registeredBehaviors)i._contactsStartedThisFrame.length=0,i._contactsEndedThisFrame.length=0;for(const i of this._registeredBehaviors)i.updateBodyFromObject();for(const i of this._physics3DHooks)i.doBeforePhysicsStep(t);const e=t>1/55?2:1;this.jolt.Step(t,e),this.stepped=!0;for(const i of this._registeredBehaviors)i.updateObjectFromBody()}registerHook(t){this._physics3DHooks.push(t)}}b.staticLayersMask=15,b.dynamicLayersMask=240,b.allLayersMask=255,b.staticBroadPhaseLayerIndex=1,b.dynamicBroadPhaseLayerIndex=1,n.Physics3DSharedData=b,n.registerRuntimeSceneUnloadedCallback(function(u){const t=u.physics3DSharedData;t&&(Jolt.destroy(t.jolt),Jolt.destroy(t.contactListener),Jolt.destroy(t._tempVec3),Jolt.destroy(t._tempRVec3),Jolt.destroy(t._tempQuat),u.physics3DSharedData=null)});class p extends n.RuntimeBehavior{constructor(t,e,i){super(t,e,i);this.shapeScale=1;this._contactsStartedThisFrame=[];this._contactsEndedThisFrame=[];this._currentContacts=[];this._body=null;this._needToRecreateBody=!1;this._needToRecreateShape=!1;this._shapeHalfDepth=0;this._objectOldX=0;this._objectOldY=0;this._objectOldZ=0;this._objectOldRotationX=0;this._objectOldRotationY=0;this._objectOldRotationZ=0;this._objectOldWidth=0;this._objectOldHeight=0;this._objectOldDepth=0;this.bodyUpdater=new n.Physics3DRuntimeBehavior.DefaultBodyUpdater(this),this.owner3D=i,this.bodyType=e.bodyType,this.bullet=e.bullet,this.fixedRotation=e.fixedRotation,this.shape=e.shape,this.shapeOrientation=e.shapeOrientation,this.shapeDimensionA=e.shapeDimensionA,this.shapeDimensionB=e.shapeDimensionB,this.shapeDimensionC=e.shapeDimensionC,this.density=e.density,this.friction=e.friction,this.restitution=e.restitution,this.linearDamping=Math.max(0,e.linearDamping),this.angularDamping=Math.max(0,e.angularDamping),this.gravityScale=e.gravityScale,this.layers=e.layers,this.masks=e.masks,this._destroyedDuringFrameLogic=!1,this._sharedData=b.getSharedData(t.getScene(),e.name),this._sharedData.addToBehaviorsList(this)}getVec3(t,e,i){const s=this._sharedData._tempVec3;return s.Set(t,e,i),s}getRVec3(t,e,i){const s=this._sharedData._tempRVec3;return s.Set(t,e,i),s}getQuat(t,e,i,s){const o=this._sharedData._tempQuat;return o.Set(t,e,i,s),o}updateFromBehaviorData(t,e){return t.bullet!==e.bullet&&this.setBullet(e.bullet),t.fixedRotation!==e.fixedRotation&&this.setFixedRotation(e.fixedRotation),t.shapeDimensionA!==e.shapeDimensionA&&(this.shapeDimensionA=e.shapeDimensionA,this._needToRecreateShape=!0),t.shapeDimensionB!==e.shapeDimensionB&&(this.shapeDimensionB=e.shapeDimensionB,this._needToRecreateShape=!0),t.density!==e.density&&this.setDensity(e.density),t.friction!==e.friction&&this.setFriction(e.friction),t.restitution!==e.restitution&&this.setRestitution(e.restitution),t.linearDamping!==e.linearDamping&&this.setLinearDamping(e.linearDamping),t.angularDamping!==e.angularDamping&&this.setAngularDamping(e.angularDamping),t.gravityScale!==e.gravityScale&&this.setGravityScale(e.gravityScale),!(t.layers!==e.layers||t.masks!==e.masks||t.vertices!==e.vertices||t.bodyType!==e.bodyType||t.shape!==e.shape)}getNetworkSyncData(){let t;if(this._body){const e=this._body.GetPosition(),i=this._body.GetRotation(),s=this._body.GetLinearVelocity(),o=this._body.GetAngularVelocity();t={px:e.GetX(),py:e.GetY(),pz:e.GetZ(),rx:i.GetX(),ry:i.GetY(),rz:i.GetZ(),rw:i.GetW(),lvx:s.GetX(),lvy:s.GetY(),lvz:s.GetZ(),avx:o.GetX(),avy:o.GetY(),avz:o.GetZ(),aw:this._body.IsActive()}}else t={px:void 0,py:void 0,pz:void 0,rx:void 0,ry:void 0,rz:void 0,rw:void 0,lvx:void 0,lvy:void 0,lvz:void 0,avx:void 0,avy:void 0,avz:void 0,aw:void 0};return{...super.getNetworkSyncData(),props:{...t,layers:this.layers,masks:this.masks}}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t);const e=t.props;e.px!==void 0&&e.py!==void 0&&e.pz!==void 0&&this._body&&this._sharedData.bodyInterface.SetPosition(this._body.GetID(),this.getVec3(e.px,e.py,e.pz),Jolt.EActivation_DontActivate),e.rx!==void 0&&e.ry!==void 0&&e.rz!==void 0&&e.rw!==void 0&&this._body&&this._sharedData.bodyInterface.SetRotation(this._body.GetID(),this.getQuat(e.rx,e.ry,e.rz,e.rw),Jolt.EActivation_DontActivate),e.lvx!==void 0&&e.lvy!==void 0&&e.lvz!==void 0&&this._body&&this._sharedData.bodyInterface.SetLinearVelocity(this._body.GetID(),this.getVec3(e.lvx,e.lvy,e.lvz)),e.avx!==void 0&&e.avy!==void 0&&e.avz!==void 0&&this._body&&this._sharedData.bodyInterface.SetAngularVelocity(this._body.GetID(),this.getVec3(e.avx,e.avy,e.avz)),e.layers!==void 0&&(this.layers=e.layers),e.masks!==void 0&&(this.masks=e.masks)}onDeActivate(){this._sharedData.removeFromBehaviorsList(this),this._body!==null&&(this._sharedData.bodyInterface.RemoveBody(this._body.GetID()),this._sharedData.bodyInterface.DestroyBody(this._body.GetID()),this._body=null),this._contactsEndedThisFrame.length=0,this._contactsStartedThisFrame.length=0,this._currentContacts.length=0}onActivate(){this._sharedData.addToBehaviorsList(this),this._contactsEndedThisFrame.length=0,this._contactsStartedThisFrame.length=0,this._currentContacts.length=0,this.updateBodyFromObject()}onDestroy(){this._destroyedDuringFrameLogic=!0,this.onDeActivate()}createShape(){let t=this.owner3D.getWidth()*this._sharedData.worldInvScale,e=this.owner3D.getHeight()*this._sharedData.worldInvScale,i=this.owner3D.getDepth()*this._sharedData.worldInvScale;if(this.shapeOrientation==="X"){const c=i;i=t,t=c}else if(this.shapeOrientation==="Y"){const c=i;i=e,e=c}const s=this.shapeScale*this._sharedData.worldInvScale,o=this.shapeDimensionA*s,a=this.shapeDimensionB*s,h=this.shapeDimensionC*s,d=this._sharedData.worldInvScale;let l,r;if(this.shape==="Box"){const c=o>0?o:t>0?t:d,y=a>0?a:e>0?e:d,_=h>0?h:i>0?i:d,D=Math.min(d,Math.min(c,y,_)/4);l=new Jolt.BoxShapeSettings(this.getVec3(c/2,y/2,_/2),D),r=this.getQuat(0,0,0,1),this._shapeHalfDepth=_/2}else if(this.shape==="Capsule"){const c=o>0?o:t>0?Math.sqrt(t*e)/2:d,y=a>0?a:i>0?i:d;l=new Jolt.CapsuleShapeSettings(Math.max(0,y/2-c),c),r=this._getShapeOrientationQuat(),this._shapeHalfDepth=this.shapeOrientation!=="Z"?c:y/2}else if(this.shape==="Cylinder"){const c=o>0?o:t>0?Math.sqrt(t*e)/2:d,y=a>0?a:i>0?i:d,_=Math.min(d,Math.min(y,c)/4);l=new Jolt.CylinderShapeSettings(y/2,c,_),r=this._getShapeOrientationQuat(),this._shapeHalfDepth=this.shapeOrientation!=="Z"?c:y/2}else{const c=o>0?o:t>0?Math.pow(t*e*i,1/3)/2:d;l=new Jolt.SphereShapeSettings(c),r=this.getQuat(0,0,0,1),this._shapeHalfDepth=c}l.mDensity=this.density;const f=new Jolt.RotatedTranslatedShapeSettings(this.getVec3(0,0,0),r,l).Create().Get();return Jolt.destroy(l),f}_getShapeOrientationQuat(){return this.shapeOrientation==="X"?this.getQuat(0,0,Math.sqrt(2)/2,-Math.sqrt(2)/2):this.shapeOrientation==="Y"?this.getQuat(0,0,0,1):this.getQuat(Math.sqrt(2)/2,0,0,Math.sqrt(2)/2)}_recreateShape(){this.bodyUpdater.recreateShape(),this._objectOldWidth=this.owner3D.getWidth(),this._objectOldHeight=this.owner3D.getHeight(),this._objectOldDepth=this.owner3D.getDepth()}getShapeScale(){return this.shapeScale}setShapeScale(t){t!==this.shapeScale&&t>0&&(this.shapeScale=t,this._needToRecreateShape=!0)}getBody(){return this._body===null&&this._createBody(),this._body}_createBody(){return this._needToRecreateBody=!1,this._needToRecreateShape=!1,!this.activated()||this._destroyedDuringFrameLogic?!1:(this._body=this.bodyUpdater.createAndAddBody(),this._body.gdjsAssociatedBehavior=this,this._objectOldWidth=this.owner3D.getWidth(),this._objectOldHeight=this.owner3D.getHeight(),this._objectOldDepth=this.owner3D.getDepth(),!0)}getBodyLayer(){return Jolt.ObjectLayerPairFilterMask.prototype.sGetObjectLayer(this.bodyType==="Static"?this.layers&n.Physics3DSharedData.staticLayersMask:this.layers&n.Physics3DSharedData.dynamicLayersMask,this.bodyType==="Static"?n.Physics3DSharedData.allLayersMask:this.masks)}doStepPreEvents(t){!this._sharedData.stepped&&!t.getScene().getTimeManager().isFirstFrame()&&this._sharedData.step(t.getScene().getTimeManager().getElapsedTime()/1e3)}doStepPostEvents(t){this._sharedData.stepped=!1}onObjectHotReloaded(){this.updateBodyFromObject()}recreateBody(){if(!this._body){this._createBody();return}const t=this._sharedData.bodyInterface,e=this._body.GetLinearVelocity(),i=e.GetX(),s=e.GetY(),o=e.GetZ(),a=this._body.GetAngularVelocity(),h=a.GetX(),d=a.GetY(),l=a.GetZ();let r=this._body.GetID();t.RemoveBody(r),t.DestroyBody(r),this._contactsEndedThisFrame.length=0,this._contactsStartedThisFrame.length=0,this._currentContacts.length=0,this._createBody(),!!this._body&&(r=this._body.GetID(),t.SetLinearVelocity(r,this.getVec3(i,s,o)),t.SetAngularVelocity(r,this.getVec3(h,d,l)))}updateObjectFromBody(){this.bodyUpdater.updateObjectFromBody(),this._objectOldX=this.owner3D.getX(),this._objectOldY=this.owner3D.getY(),this._objectOldZ=this.owner3D.getZ(),this._objectOldRotationX=this.owner3D.getRotationX(),this._objectOldRotationY=this.owner3D.getRotationY(),this._objectOldRotationZ=this.owner3D.getAngle()}updateBodyFromObject(){this._body===null&&!this._createBody()||(this._needToRecreateBody&&this.recreateBody(),(this._needToRecreateShape||!this.hasCustomShapeDimension()&&(this._objectOldWidth!==this.owner3D.getWidth()||this._objectOldHeight!==this.owner3D.getHeight()||this._objectOldDepth!==this.owner3D.getDepth()))&&(this._needToRecreateShape=!1,this._recreateShape()),this.bodyUpdater.updateBodyFromObject())}hasCustomShapeDimension(){return this.shapeDimensionA>0||this.shapeDimensionB>0||this.shapeDimensionC>0}getPhysicsPosition(t){return t.Set(this.owner3D.getCenterXInScene()*this._sharedData.worldInvScale,this.owner3D.getCenterYInScene()*this._sharedData.worldInvScale,this.owner3D.getCenterZInScene()*this._sharedData.worldInvScale),t}getPhysicsRotation(t){const e=this.owner3D.get3DRendererObject();return t.Set(e.quaternion.x,e.quaternion.y,e.quaternion.z,e.quaternion.w),t}moveObjectToPhysicsPosition(t){this.owner3D.setCenterXInScene(t.GetX()*this._sharedData.worldScale),this.owner3D.setCenterYInScene(t.GetY()*this._sharedData.worldScale),this.owner3D.setCenterZInScene(t.GetZ()*this._sharedData.worldScale)}moveObjectToPhysicsRotation(t){const e=this.owner3D.get3DRendererObject();e.quaternion.x=t.GetX(),e.quaternion.y=t.GetY(),e.quaternion.z=t.GetZ(),e.quaternion.w=t.GetW();const i=new THREE.Euler(0,0,0,"ZYX");i.setFromQuaternion(e.quaternion),this.owner3D.setRotationX(n.toDegrees(i.x)),this.owner3D.setRotationY(n.toDegrees(i.y)),this.owner3D.setAngle(n.toDegrees(i.z))}getWorldScale(){return this._sharedData.worldScale}getGravityX(){return this._sharedData.gravityX}getGravityY(){return this._sharedData.gravityY}getGravityZ(){return this._sharedData.gravityZ}setGravityX(t){this._sharedData.gravityX!==t&&(this._sharedData.gravityX=t,this._sharedData.physicsSystem.SetGravity(this.getVec3(this._sharedData.gravityX,this._sharedData.gravityY,this._sharedData.gravityZ)))}setGravityY(t){this._sharedData.gravityX!==t&&(this._sharedData.gravityX=t,this._sharedData.physicsSystem.SetGravity(this.getVec3(this._sharedData.gravityX,this._sharedData.gravityY,this._sharedData.gravityZ)))}setGravityZ(t){this._sharedData.gravityX!==t&&(this._sharedData.gravityZ=t,this._sharedData.physicsSystem.SetGravity(this.getVec3(this._sharedData.gravityX,this._sharedData.gravityY,this._sharedData.gravityZ)))}isDynamic(){return this.bodyType==="Dynamic"}isStatic(){return this.bodyType==="Static"}isKinematic(){return this.bodyType==="Kinematic"}isBullet(){return this.bullet}setBullet(t){if(this.bullet===t||(this.bullet=t,this._body===null&&!this._createBody()))return;const e=this._body;this._sharedData.bodyInterface.SetMotionQuality(e.GetID(),this.bullet?Jolt.EMotionQuality_LinearCast:Jolt.EMotionQuality_Discrete)}hasFixedRotation(){return this.fixedRotation}setFixedRotation(t){this.fixedRotation!==t&&(this.fixedRotation=t,this._needToRecreateBody=!0)}getDensity(){return this.density}setDensity(t){t<0&&(t=0),this.density!==t&&(this.density=t,this._needToRecreateShape=!0)}getFriction(){return this.friction}setFriction(t){if(t<0&&(t=0),this.friction===t||(this.friction=t,this._body===null&&!this._createBody()))return;const e=this._body;this._sharedData.bodyInterface.SetFriction(e.GetID(),t)}getRestitution(){return this.restitution}setRestitution(t){if(t<0&&(t=0),this.restitution===t||(this.restitution=t,this._body===null&&!this._createBody()))return;const e=this._body;this._sharedData.bodyInterface.SetRestitution(e.GetID(),t)}getLinearDamping(){return this.linearDamping}setLinearDamping(t){if(t<0&&(t=0),this.linearDamping===t||(this.linearDamping=t,this._body===null&&!this._createBody()))return;this._body.GetMotionProperties().SetLinearDamping(t)}getAngularDamping(){return this.angularDamping}setAngularDamping(t){if(t<0&&(t=0),this.angularDamping===t||(this.angularDamping=t,this._body===null&&!this._createBody()))return;this._body.GetMotionProperties().SetAngularDamping(t)}getGravityScale(){return this.gravityScale}setGravityScale(t){if(this.gravityScale===t||(this.gravityScale=t,this._body===null&&!this._createBody()))return;this._body.GetMotionProperties().SetGravityFactor(t)}layerEnabled(t){return t=Math.floor(t),t<1||t>8?!1:!!(this.layers&1<<t-1)}enableLayer(t,e){t=Math.floor(t),!(t<1||t>8)&&(e?this.layers|=1<<t-1:this.layers&=~(1<<t-1),this._needToRecreateBody=!0)}maskEnabled(t){return t=Math.floor(t),t<1||t>16?!1:!!(this.masks&1<<t-1)}enableMask(t,e){t=Math.floor(t),!(t<1||t>16)&&(e?this.masks|=1<<t-1:this.masks&=~(1<<t-1),this._needToRecreateBody=!0)}getLinearVelocityX(){return this._body===null&&!this._createBody()?0:this._body.GetLinearVelocity().GetX()*this._sharedData.worldScale}setLinearVelocityX(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetLinearVelocity(e.GetID(),this.getVec3(t*this._sharedData.worldInvScale,e.GetLinearVelocity().GetY(),e.GetLinearVelocity().GetZ()))}getLinearVelocityY(){return this._body===null&&!this._createBody()?0:this._body.GetLinearVelocity().GetY()*this._sharedData.worldScale}setLinearVelocityY(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetLinearVelocity(e.GetID(),this.getVec3(e.GetLinearVelocity().GetX(),t*this._sharedData.worldInvScale,e.GetLinearVelocity().GetZ()))}getLinearVelocityZ(){return this._body===null&&!this._createBody()?0:this._body.GetLinearVelocity().GetZ()*this._sharedData.worldScale}setLinearVelocityZ(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetLinearVelocity(e.GetID(),this.getVec3(e.GetLinearVelocity().GetX(),e.GetLinearVelocity().GetY(),t*this._sharedData.worldInvScale))}getLinearVelocityLength(){return this._body===null&&!this._createBody()?0:this._body.GetLinearVelocity().Length()*this._sharedData.worldScale}getAngularVelocityX(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return n.toDegrees(t.GetAngularVelocity().GetX())}setAngularVelocityX(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetAngularVelocity(e.GetID(),this.getVec3(n.toRad(t),e.GetAngularVelocity().GetY(),e.GetAngularVelocity().GetZ()))}getAngularVelocityY(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return n.toDegrees(t.GetAngularVelocity().GetY())}setAngularVelocityY(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetAngularVelocity(e.GetID(),this.getVec3(e.GetAngularVelocity().GetX(),n.toRad(t),e.GetAngularVelocity().GetZ()))}getAngularVelocityZ(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return n.toDegrees(t.GetAngularVelocity().GetZ())}setAngularVelocityZ(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetAngularVelocity(e.GetID(),this.getVec3(e.GetAngularVelocity().GetX(),e.GetAngularVelocity().GetY(),n.toRad(t)))}applyForce(t,e,i,s,o,a){if(this._body===null&&!this._createBody())return;const h=this._body;this._sharedData.bodyInterface.AddForce(h.GetID(),this.getVec3(t,e,i),this.getRVec3(s*this._sharedData.worldInvScale,o*this._sharedData.worldInvScale,a*this._sharedData.worldInvScale),Jolt.EActivation_Activate)}applyForceAtCenter(t,e,i){if(this._body===null&&!this._createBody())return;const s=this._body;this._sharedData.bodyInterface.AddForce(s.GetID(),this.getVec3(t,e,i),Jolt.EActivation_Activate)}applyForceTowardPosition(t,e,i,s){if(this._body===null&&!this._createBody())return;const o=this._body,a=e-o.GetPosition().GetX(),h=i-o.GetPosition().GetY(),d=s-o.GetPosition().GetZ(),l=a*a+h*h+d*d;if(l===0)return;const r=t/l;this._sharedData.bodyInterface.AddForce(o.GetID(),this.getVec3(a*r,h*r,d*r),Jolt.EActivation_Activate)}applyImpulse(t,e,i,s,o,a){if(this._body===null&&!this._createBody())return;const h=this._body;this._sharedData.bodyInterface.AddImpulse(h.GetID(),this.getVec3(t,e,i),this.getRVec3(s*this._sharedData.worldInvScale,o*this._sharedData.worldInvScale,a*this._sharedData.worldInvScale))}applyImpulseAtCenter(t,e,i){if(this._body===null&&!this._createBody())return;const s=this._body;this._sharedData.bodyInterface.AddImpulse(s.GetID(),this.getVec3(t,e,i))}applyImpulseTowardPosition(t,e,i,s,o,a,h){if(this._body===null&&!this._createBody())return;const d=this._body,l=e-o,r=i-a,f=s-h,c=l*l+r*r+f*f;if(c===0)return;const y=t/c;this._sharedData.bodyInterface.AddImpulse(d.GetID(),this.getVec3(l*y,r*y,f*y),this.getRVec3(o*this._sharedData.worldInvScale,a*this._sharedData.worldInvScale,h*this._sharedData.worldInvScale))}applyTorque(t,e,i){if(this._body===null&&!this._createBody())return;const s=this._body;this._sharedData.bodyInterface.AddTorque(s.GetID(),this.getVec3(n.toRad(t),n.toRad(e),n.toRad(i)),Jolt.EActivation_Activate)}applyAngularImpulse(t,e,i){if(this._body===null&&!this._createBody())return;const s=this._body;this._sharedData.bodyInterface.AddAngularImpulse(s.GetID(),this.getVec3(n.toRad(t),n.toRad(e),n.toRad(i)))}getMass(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return 1/t.GetMotionProperties().GetInverseMass()}getInertiaAroundX(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return 1/t.GetMotionProperties().GetInverseInertiaDiagonal().GetX()}getInertiaAroundY(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return 1/t.GetMotionProperties().GetInverseInertiaDiagonal().GetY()}getInertiaAroundZ(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return 1/t.GetMotionProperties().GetInverseInertiaDiagonal().GetZ()}getMassCenterX(){return this._body===null&&!this._createBody()?0:this._body.GetCenterOfMassPosition().GetX()*this._sharedData.worldScale}getMassCenterY(){return this._body===null&&!this._createBody()?0:this._body.GetCenterOfMassPosition().GetY()*this._sharedData.worldScale}getMassCenterZ(){return this._body===null&&!this._createBody()?0:this._body.GetCenterOfMassPosition().GetZ()*this._sharedData.worldScale}onContactBegin(t){this._currentContacts.push(t);let e=this._contactsEndedThisFrame.indexOf(t);e!==-1?this._contactsEndedThisFrame.splice(e,1):this._contactsStartedThisFrame.push(t)}onContactEnd(t){this._contactsEndedThisFrame.push(t);const e=this._currentContacts.indexOf(t);e!==-1&&this._currentContacts.splice(e,1)}static areObjectsColliding(t,e,i){const s=t.getBehavior(i);return s?!!(s._currentContacts.some(o=>o.owner===e)||s._contactsStartedThisFrame.some(o=>o.owner===e)):!1}static hasCollisionStartedBetween(t,e,i){const s=t.getBehavior(i);return s?s._contactsStartedThisFrame.some(o=>o.owner===e):!1}static hasCollisionStoppedBetween(t,e,i){const s=t.getBehavior(i);return s?s._contactsEndedThisFrame.some(o=>o.owner===e):!1}}n.Physics3DRuntimeBehavior=p,n.registerBehavior("Physics3D::Physics3DBehavior",n.Physics3DRuntimeBehavior),function(t){class u{constructor(i){this.behavior=i}createAndAddBody(){const{behavior:i}=this,{_sharedData:s}=i,o=i.createShape(),a=new Jolt.BodyCreationSettings(o,i.getPhysicsPosition(s.getRVec3(0,0,0)),i.getPhysicsRotation(s.getQuat(0,0,0,1)),i.bodyType==="Static"?Jolt.EMotionType_Static:i.bodyType==="Kinematic"?Jolt.EMotionType_Kinematic:Jolt.EMotionType_Dynamic,i.getBodyLayer());a.mMotionQuality=i.bullet?Jolt.EMotionQuality_LinearCast:Jolt.EMotionQuality_Discrete,a.mAllowedDOFs=i.fixedRotation?Jolt.EAllowedDOFs_TranslationX|Jolt.EAllowedDOFs_TranslationY|Jolt.EAllowedDOFs_TranslationZ:Jolt.EAllowedDOFs_All,a.mFriction=i.friction,a.mRestitution=i.restitution,a.mLinearDamping=i.linearDamping,a.mAngularDamping=i.angularDamping,a.mGravityFactor=i.gravityScale;const h=s.bodyInterface,d=h.CreateBody(a);return Jolt.destroy(a),h.AddBody(d.GetID(),Jolt.EActivation_Activate),d}updateObjectFromBody(){const{behavior:i}=this,{_body:s}=i;s!==null&&(i.moveObjectToPhysicsPosition(s.GetPosition()),i.moveObjectToPhysicsRotation(s.GetRotation()))}updateBodyFromObject(){const{behavior:i}=this,{owner3D:s,_sharedData:o}=i;if(i._body===null&&!i._createBody())return;const a=i._body;(this.behavior._objectOldX!==s.getX()||this.behavior._objectOldY!==s.getY()||this.behavior._objectOldZ!==s.getZ()||this.behavior._objectOldRotationX!==s.getRotationX()||this.behavior._objectOldRotationY!==s.getRotationY()||this.behavior._objectOldRotationZ!==s.getAngle())&&o.bodyInterface.SetPositionAndRotationWhenChanged(a.GetID(),this.behavior.getPhysicsPosition(o.getRVec3(0,0,0)),this.behavior.getPhysicsRotation(o.getQuat(0,0,0,1)),Jolt.EActivation_Activate)}recreateShape(){const{behavior:i}=this,{_sharedData:s}=i;if(i._body===null&&!i._createBody())return;const o=i._body;s.bodyInterface.SetShape(o.GetID(),i.createShape(),!0,Jolt.EActivation_Activate)}}t.DefaultBodyUpdater=u}(p=n.Physics3DRuntimeBehavior||(n.Physics3DRuntimeBehavior={}))})(gdjs||(gdjs={}));
|
|
1
|
+
var gdjs;(function(n){const p=async()=>{try{const t=(await import("./jolt-physics.wasm.js")).default;if(!t)throw new Error("No default export found in Jolt.");const e=await t();window.Jolt=e}catch(u){throw console.error("Unable to load Jolt physics library.",u),u}};n.registerAsynchronouslyLoadingLibraryPromise(p());class b{constructor(t,e){this._tempVec3=new Jolt.Vec3;this._tempRVec3=new Jolt.RVec3;this._tempQuat=new Jolt.Quat;this.stepped=!1;this._physics3DHooks=[];this._registeredBehaviors=new Set,this.gravityX=e.gravityX,this.gravityY=e.gravityY,this.gravityZ=e.gravityZ,this.worldScale=e.worldScale,this.worldInvScale=1/this.worldScale;const o=new Jolt.JoltSettings;n.Physics3DSharedData.setupCollisionFiltering(o),this.jolt=new Jolt.JoltInterface(o),Jolt.destroy(o),this.physicsSystem=this.jolt.GetPhysicsSystem(),this.physicsSystem.SetGravity(this.getVec3(this.gravityX,this.gravityY,this.gravityZ)),this.bodyInterface=this.physicsSystem.GetBodyInterface(),this.contactListener=new Jolt.ContactListenerJS,this.physicsSystem.SetContactListener(this.contactListener),this.contactListener.OnContactAdded=(i,s,a,r)=>{const d=Jolt.wrapPointer(i,Jolt.Body),l=Jolt.wrapPointer(s,Jolt.Body),h=d.gdjsAssociatedBehavior,f=l.gdjsAssociatedBehavior;!h||!f||(h.onContactBegin(f),f.onContactBegin(h))},this.contactListener.OnContactRemoved=i=>{const s=Jolt.wrapPointer(i,Jolt.SubShapeIDPair),a=this.physicsSystem.GetBodyLockInterface(),r=a.TryGetBody(s.GetBody1ID()),d=a.TryGetBody(s.GetBody2ID()),l=r.gdjsAssociatedBehavior,h=d.gdjsAssociatedBehavior;!l||!h||(l.onContactEnd(h),h.onContactEnd(l))},this.contactListener.OnContactPersisted=(i,s,a,r)=>{},this.contactListener.OnContactValidate=(i,s,a,r)=>Jolt.ValidateResult_AcceptAllContactsForThisBodyPair}getVec3(t,e,o){const i=this._tempVec3;return i.Set(t,e,o),i}getRVec3(t,e,o){const i=this._tempRVec3;return i.Set(t,e,o),i}getQuat(t,e,o,i){const s=this._tempQuat;return s.Set(t,e,o,i),s}static getSharedData(t,e){if(!t.physics3DSharedData){const o=t.getInitialSharedDataForBehavior(e);t.physics3DSharedData=new n.Physics3DSharedData(t,o)}return t.physics3DSharedData}static setupCollisionFiltering(t){const e=new Jolt.ObjectLayerPairFilterMask,o=new Jolt.BroadPhaseLayer(n.Physics3DSharedData.staticBroadPhaseLayerIndex),i=new Jolt.BroadPhaseLayer(n.Physics3DSharedData.dynamicBroadPhaseLayerIndex),s=new Jolt.BroadPhaseLayerInterfaceMask(2);s.ConfigureLayer(o,n.Physics3DSharedData.staticLayersMask,0),s.ConfigureLayer(i,n.Physics3DSharedData.dynamicLayersMask,0),Jolt.destroy(o),Jolt.destroy(i),t.mObjectLayerPairFilter=e,t.mBroadPhaseLayerInterface=s,t.mObjectVsBroadPhaseLayerFilter=new Jolt.ObjectVsBroadPhaseLayerFilterMask(s)}addToBehaviorsList(t){this._registeredBehaviors.add(t)}removeFromBehaviorsList(t){this._registeredBehaviors.delete(t)}step(t){for(const o of this._registeredBehaviors)o._contactsStartedThisFrame.length=0,o._contactsEndedThisFrame.length=0;for(const o of this._registeredBehaviors)o.updateBodyFromObject();for(const o of this._physics3DHooks)o.doBeforePhysicsStep(t);const e=t>1/55?2:1;this.jolt.Step(t,e),this.stepped=!0;for(const o of this._registeredBehaviors)o.updateObjectFromBody()}registerHook(t){this._physics3DHooks.push(t)}}b.staticLayersMask=15,b.dynamicLayersMask=240,b.allLayersMask=255,b.staticBroadPhaseLayerIndex=1,b.dynamicBroadPhaseLayerIndex=1,n.Physics3DSharedData=b,n.registerRuntimeSceneUnloadedCallback(function(u){const t=u.physics3DSharedData;t&&(Jolt.destroy(t.jolt),Jolt.destroy(t.contactListener),Jolt.destroy(t._tempVec3),Jolt.destroy(t._tempRVec3),Jolt.destroy(t._tempQuat),u.physics3DSharedData=null)});class _ extends n.RuntimeBehavior{constructor(t,e,o){super(t,e,o);this.shapeScale=1;this._contactsStartedThisFrame=[];this._contactsEndedThisFrame=[];this._currentContacts=[];this._body=null;this._needToRecreateBody=!1;this._needToRecreateShape=!1;this._shapeHalfDepth=0;this._objectOldX=0;this._objectOldY=0;this._objectOldZ=0;this._objectOldRotationX=0;this._objectOldRotationY=0;this._objectOldRotationZ=0;this._objectOldWidth=0;this._objectOldHeight=0;this._objectOldDepth=0;this.bodyUpdater=new n.Physics3DRuntimeBehavior.DefaultBodyUpdater(this),this.collisionChecker=new n.Physics3DRuntimeBehavior.DefaultCollisionChecker(this),this.owner3D=o,this.bodyType=e.bodyType,this.bullet=e.bullet,this.fixedRotation=e.fixedRotation,this.shape=e.shape,this.shapeOrientation=e.shapeOrientation,this.shapeDimensionA=e.shapeDimensionA,this.shapeDimensionB=e.shapeDimensionB,this.shapeDimensionC=e.shapeDimensionC,this.density=e.density,this.friction=e.friction,this.restitution=e.restitution,this.linearDamping=Math.max(0,e.linearDamping),this.angularDamping=Math.max(0,e.angularDamping),this.gravityScale=e.gravityScale,this.layers=e.layers,this.masks=e.masks,this._destroyedDuringFrameLogic=!1,this._sharedData=b.getSharedData(t.getScene(),e.name),this._sharedData.addToBehaviorsList(this)}getVec3(t,e,o){const i=this._sharedData._tempVec3;return i.Set(t,e,o),i}getRVec3(t,e,o){const i=this._sharedData._tempRVec3;return i.Set(t,e,o),i}getQuat(t,e,o,i){const s=this._sharedData._tempQuat;return s.Set(t,e,o,i),s}updateFromBehaviorData(t,e){return t.bullet!==e.bullet&&this.setBullet(e.bullet),t.fixedRotation!==e.fixedRotation&&this.setFixedRotation(e.fixedRotation),t.shapeDimensionA!==e.shapeDimensionA&&(this.shapeDimensionA=e.shapeDimensionA,this._needToRecreateShape=!0),t.shapeDimensionB!==e.shapeDimensionB&&(this.shapeDimensionB=e.shapeDimensionB,this._needToRecreateShape=!0),t.density!==e.density&&this.setDensity(e.density),t.friction!==e.friction&&this.setFriction(e.friction),t.restitution!==e.restitution&&this.setRestitution(e.restitution),t.linearDamping!==e.linearDamping&&this.setLinearDamping(e.linearDamping),t.angularDamping!==e.angularDamping&&this.setAngularDamping(e.angularDamping),t.gravityScale!==e.gravityScale&&this.setGravityScale(e.gravityScale),!(t.layers!==e.layers||t.masks!==e.masks||t.vertices!==e.vertices||t.bodyType!==e.bodyType||t.shape!==e.shape)}getNetworkSyncData(){let t;if(this._body){const e=this._body.GetPosition(),o=this._body.GetRotation(),i=this._body.GetLinearVelocity(),s=this._body.GetAngularVelocity();t={px:e.GetX(),py:e.GetY(),pz:e.GetZ(),rx:o.GetX(),ry:o.GetY(),rz:o.GetZ(),rw:o.GetW(),lvx:i.GetX(),lvy:i.GetY(),lvz:i.GetZ(),avx:s.GetX(),avy:s.GetY(),avz:s.GetZ(),aw:this._body.IsActive()}}else t={px:void 0,py:void 0,pz:void 0,rx:void 0,ry:void 0,rz:void 0,rw:void 0,lvx:void 0,lvy:void 0,lvz:void 0,avx:void 0,avy:void 0,avz:void 0,aw:void 0};return{...super.getNetworkSyncData(),props:{...t,layers:this.layers,masks:this.masks}}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t);const e=t.props;e.px!==void 0&&e.py!==void 0&&e.pz!==void 0&&this._body&&this._sharedData.bodyInterface.SetPosition(this._body.GetID(),this.getRVec3(e.px,e.py,e.pz),Jolt.EActivation_DontActivate),e.rx!==void 0&&e.ry!==void 0&&e.rz!==void 0&&e.rw!==void 0&&this._body&&this._sharedData.bodyInterface.SetRotation(this._body.GetID(),this.getQuat(e.rx,e.ry,e.rz,e.rw),Jolt.EActivation_DontActivate),e.lvx!==void 0&&e.lvy!==void 0&&e.lvz!==void 0&&this._body&&this._sharedData.bodyInterface.SetLinearVelocity(this._body.GetID(),this.getVec3(e.lvx,e.lvy,e.lvz)),e.avx!==void 0&&e.avy!==void 0&&e.avz!==void 0&&this._body&&this._sharedData.bodyInterface.SetAngularVelocity(this._body.GetID(),this.getVec3(e.avx,e.avy,e.avz)),e.layers!==void 0&&(this.layers=e.layers),e.masks!==void 0&&(this.masks=e.masks)}onDeActivate(){this._sharedData.removeFromBehaviorsList(this),this._body!==null&&(this._sharedData.bodyInterface.RemoveBody(this._body.GetID()),this._sharedData.bodyInterface.DestroyBody(this._body.GetID()),this._body=null),this._contactsEndedThisFrame.length=0,this._contactsStartedThisFrame.length=0,this._currentContacts.length=0}onActivate(){this._sharedData.addToBehaviorsList(this),this._contactsEndedThisFrame.length=0,this._contactsStartedThisFrame.length=0,this._currentContacts.length=0,this.updateBodyFromObject()}onDestroy(){this._destroyedDuringFrameLogic=!0,this.onDeActivate()}createShape(){let t=this.owner3D.getWidth()*this._sharedData.worldInvScale,e=this.owner3D.getHeight()*this._sharedData.worldInvScale,o=this.owner3D.getDepth()*this._sharedData.worldInvScale;if(this.shapeOrientation==="X"){const c=o;o=t,t=c}else if(this.shapeOrientation==="Y"){const c=o;o=e,e=c}const i=this.shapeScale*this._sharedData.worldInvScale,s=this.shapeDimensionA*i,a=this.shapeDimensionB*i,r=this.shapeDimensionC*i,d=this._sharedData.worldInvScale;let l,h;if(this.shape==="Box"){const c=s>0?s:t>0?t:d,y=a>0?a:e>0?e:d,g=r>0?r:o>0?o:d,D=Math.min(d,Math.min(c,y,g)/4);l=new Jolt.BoxShapeSettings(this.getVec3(c/2,y/2,g/2),D),h=this.getQuat(0,0,0,1),this._shapeHalfDepth=g/2}else if(this.shape==="Capsule"){const c=s>0?s:t>0?Math.sqrt(t*e)/2:d,y=a>0?a:o>0?o:d;l=new Jolt.CapsuleShapeSettings(Math.max(0,y/2-c),c),h=this._getShapeOrientationQuat(),this._shapeHalfDepth=this.shapeOrientation!=="Z"?c:y/2}else if(this.shape==="Cylinder"){const c=s>0?s:t>0?Math.sqrt(t*e)/2:d,y=a>0?a:o>0?o:d,g=Math.min(d,Math.min(y,c)/4);l=new Jolt.CylinderShapeSettings(y/2,c,g),h=this._getShapeOrientationQuat(),this._shapeHalfDepth=this.shapeOrientation!=="Z"?c:y/2}else{const c=s>0?s:t>0?Math.pow(t*e*o,1/3)/2:d;l=new Jolt.SphereShapeSettings(c),h=this.getQuat(0,0,0,1),this._shapeHalfDepth=c}l.mDensity=this.density;const f=new Jolt.RotatedTranslatedShapeSettings(this.getVec3(0,0,0),h,l).Create().Get();return Jolt.destroy(l),f}_getShapeOrientationQuat(){return this.shapeOrientation==="X"?this.getQuat(0,0,Math.sqrt(2)/2,-Math.sqrt(2)/2):this.shapeOrientation==="Y"?this.getQuat(0,0,0,1):this.getQuat(Math.sqrt(2)/2,0,0,Math.sqrt(2)/2)}_recreateShape(){this.bodyUpdater.recreateShape(),this._objectOldWidth=this.owner3D.getWidth(),this._objectOldHeight=this.owner3D.getHeight(),this._objectOldDepth=this.owner3D.getDepth()}getShapeScale(){return this.shapeScale}setShapeScale(t){t!==this.shapeScale&&t>0&&(this.shapeScale=t,this._needToRecreateShape=!0)}getBody(){return this._body===null&&this._createBody(),this._body}_createBody(){return this._needToRecreateBody=!1,this._needToRecreateShape=!1,!this.activated()||this._destroyedDuringFrameLogic?!1:(this._body=this.bodyUpdater.createAndAddBody(),this._body.gdjsAssociatedBehavior=this,this._objectOldWidth=this.owner3D.getWidth(),this._objectOldHeight=this.owner3D.getHeight(),this._objectOldDepth=this.owner3D.getDepth(),!0)}getBodyLayer(){return Jolt.ObjectLayerPairFilterMask.prototype.sGetObjectLayer(this.getLayersAccordingToBodyType(),this.getMasksAccordingToBodyType())}getLayersAccordingToBodyType(){return this.isStatic()?this.layers&n.Physics3DSharedData.staticLayersMask:this.layers&n.Physics3DSharedData.dynamicLayersMask}getMasksAccordingToBodyType(){return this.isStatic()?n.Physics3DSharedData.allLayersMask:this.masks}doStepPreEvents(t){!this._sharedData.stepped&&!t.getScene().getTimeManager().isFirstFrame()&&this._sharedData.step(t.getScene().getTimeManager().getElapsedTime()/1e3)}doStepPostEvents(t){this._sharedData.stepped=!1}onObjectHotReloaded(){this.updateBodyFromObject()}recreateBody(){if(!this._body){this._createBody();return}const t=this._sharedData.bodyInterface,e=this._body.GetLinearVelocity(),o=e.GetX(),i=e.GetY(),s=e.GetZ(),a=this._body.GetAngularVelocity(),r=a.GetX(),d=a.GetY(),l=a.GetZ();let h=this._body.GetID();t.RemoveBody(h),t.DestroyBody(h),this._contactsEndedThisFrame.length=0,this._contactsStartedThisFrame.length=0,this._currentContacts.length=0,this._createBody(),!!this._body&&(h=this._body.GetID(),t.SetLinearVelocity(h,this.getVec3(o,i,s)),t.SetAngularVelocity(h,this.getVec3(r,d,l)))}updateObjectFromBody(){this.bodyUpdater.updateObjectFromBody(),this._objectOldX=this.owner3D.getX(),this._objectOldY=this.owner3D.getY(),this._objectOldZ=this.owner3D.getZ(),this._objectOldRotationX=this.owner3D.getRotationX(),this._objectOldRotationY=this.owner3D.getRotationY(),this._objectOldRotationZ=this.owner3D.getAngle()}updateBodyFromObject(){this._body===null&&!this._createBody()||(this._needToRecreateBody&&this.recreateBody(),(this._needToRecreateShape||!this.hasCustomShapeDimension()&&(this._objectOldWidth!==this.owner3D.getWidth()||this._objectOldHeight!==this.owner3D.getHeight()||this._objectOldDepth!==this.owner3D.getDepth()))&&(this._needToRecreateShape=!1,this._recreateShape()),this.bodyUpdater.updateBodyFromObject())}hasCustomShapeDimension(){return this.shapeDimensionA>0||this.shapeDimensionB>0||this.shapeDimensionC>0}getPhysicsPosition(t){return t.Set(this.owner3D.getCenterXInScene()*this._sharedData.worldInvScale,this.owner3D.getCenterYInScene()*this._sharedData.worldInvScale,this.owner3D.getCenterZInScene()*this._sharedData.worldInvScale),t}getPhysicsRotation(t){const e=this.owner3D.get3DRendererObject();return t.Set(e.quaternion.x,e.quaternion.y,e.quaternion.z,e.quaternion.w),t}moveObjectToPhysicsPosition(t){this.owner3D.setCenterXInScene(t.GetX()*this._sharedData.worldScale),this.owner3D.setCenterYInScene(t.GetY()*this._sharedData.worldScale),this.owner3D.setCenterZInScene(t.GetZ()*this._sharedData.worldScale)}moveObjectToPhysicsRotation(t){const e=this.owner3D.get3DRendererObject();e.quaternion.x=t.GetX(),e.quaternion.y=t.GetY(),e.quaternion.z=t.GetZ(),e.quaternion.w=t.GetW();const o=new THREE.Euler(0,0,0,"ZYX");o.setFromQuaternion(e.quaternion),this.owner3D.setRotationX(n.toDegrees(o.x)),this.owner3D.setRotationY(n.toDegrees(o.y)),this.owner3D.setAngle(n.toDegrees(o.z))}getWorldScale(){return this._sharedData.worldScale}getGravityX(){return this._sharedData.gravityX}getGravityY(){return this._sharedData.gravityY}getGravityZ(){return this._sharedData.gravityZ}setGravityX(t){this._sharedData.gravityX!==t&&(this._sharedData.gravityX=t,this._sharedData.physicsSystem.SetGravity(this.getVec3(this._sharedData.gravityX,this._sharedData.gravityY,this._sharedData.gravityZ)))}setGravityY(t){this._sharedData.gravityX!==t&&(this._sharedData.gravityX=t,this._sharedData.physicsSystem.SetGravity(this.getVec3(this._sharedData.gravityX,this._sharedData.gravityY,this._sharedData.gravityZ)))}setGravityZ(t){this._sharedData.gravityX!==t&&(this._sharedData.gravityZ=t,this._sharedData.physicsSystem.SetGravity(this.getVec3(this._sharedData.gravityX,this._sharedData.gravityY,this._sharedData.gravityZ)))}isDynamic(){return this.bodyType==="Dynamic"}isStatic(){return this.bodyType==="Static"}isKinematic(){return this.bodyType==="Kinematic"}isBullet(){return this.bullet}setBullet(t){if(this.bullet===t||(this.bullet=t,this._body===null&&!this._createBody()))return;const e=this._body;this._sharedData.bodyInterface.SetMotionQuality(e.GetID(),this.bullet?Jolt.EMotionQuality_LinearCast:Jolt.EMotionQuality_Discrete)}hasFixedRotation(){return this.fixedRotation}setFixedRotation(t){this.fixedRotation!==t&&(this.fixedRotation=t,this._needToRecreateBody=!0)}getDensity(){return this.density}setDensity(t){t<0&&(t=0),this.density!==t&&(this.density=t,this._needToRecreateShape=!0)}getFriction(){return this.friction}setFriction(t){if(t<0&&(t=0),this.friction===t||(this.friction=t,this._body===null&&!this._createBody()))return;const e=this._body;this._sharedData.bodyInterface.SetFriction(e.GetID(),t)}getRestitution(){return this.restitution}setRestitution(t){if(t<0&&(t=0),this.restitution===t||(this.restitution=t,this._body===null&&!this._createBody()))return;const e=this._body;this._sharedData.bodyInterface.SetRestitution(e.GetID(),t)}getLinearDamping(){return this.linearDamping}setLinearDamping(t){if(t<0&&(t=0),this.linearDamping===t||(this.linearDamping=t,this._body===null&&!this._createBody()))return;this._body.GetMotionProperties().SetLinearDamping(t)}getAngularDamping(){return this.angularDamping}setAngularDamping(t){if(t<0&&(t=0),this.angularDamping===t||(this.angularDamping=t,this._body===null&&!this._createBody()))return;this._body.GetMotionProperties().SetAngularDamping(t)}getGravityScale(){return this.gravityScale}setGravityScale(t){if(this.gravityScale===t||(this.gravityScale=t,this._body===null&&!this._createBody()))return;this._body.GetMotionProperties().SetGravityFactor(t)}layerEnabled(t){return t=Math.floor(t),t<1||t>8?!1:!!(this.layers&1<<t-1)}enableLayer(t,e){t=Math.floor(t),!(t<1||t>8)&&(e?this.layers|=1<<t-1:this.layers&=~(1<<t-1),this._needToRecreateBody=!0)}maskEnabled(t){return t=Math.floor(t),t<1||t>16?!1:!!(this.masks&1<<t-1)}enableMask(t,e){t=Math.floor(t),!(t<1||t>16)&&(e?this.masks|=1<<t-1:this.masks&=~(1<<t-1),this._needToRecreateBody=!0)}getLinearVelocityX(){return this._body===null&&!this._createBody()?0:this._body.GetLinearVelocity().GetX()*this._sharedData.worldScale}setLinearVelocityX(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetLinearVelocity(e.GetID(),this.getVec3(t*this._sharedData.worldInvScale,e.GetLinearVelocity().GetY(),e.GetLinearVelocity().GetZ()))}getLinearVelocityY(){return this._body===null&&!this._createBody()?0:this._body.GetLinearVelocity().GetY()*this._sharedData.worldScale}setLinearVelocityY(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetLinearVelocity(e.GetID(),this.getVec3(e.GetLinearVelocity().GetX(),t*this._sharedData.worldInvScale,e.GetLinearVelocity().GetZ()))}getLinearVelocityZ(){return this._body===null&&!this._createBody()?0:this._body.GetLinearVelocity().GetZ()*this._sharedData.worldScale}setLinearVelocityZ(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetLinearVelocity(e.GetID(),this.getVec3(e.GetLinearVelocity().GetX(),e.GetLinearVelocity().GetY(),t*this._sharedData.worldInvScale))}getLinearVelocityLength(){return this._body===null&&!this._createBody()?0:this._body.GetLinearVelocity().Length()*this._sharedData.worldScale}getAngularVelocityX(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return n.toDegrees(t.GetAngularVelocity().GetX())}setAngularVelocityX(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetAngularVelocity(e.GetID(),this.getVec3(n.toRad(t),e.GetAngularVelocity().GetY(),e.GetAngularVelocity().GetZ()))}getAngularVelocityY(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return n.toDegrees(t.GetAngularVelocity().GetY())}setAngularVelocityY(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetAngularVelocity(e.GetID(),this.getVec3(e.GetAngularVelocity().GetX(),n.toRad(t),e.GetAngularVelocity().GetZ()))}getAngularVelocityZ(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return n.toDegrees(t.GetAngularVelocity().GetZ())}setAngularVelocityZ(t){if(this._body===null&&!this._createBody())return;const e=this._body;this._sharedData.bodyInterface.SetAngularVelocity(e.GetID(),this.getVec3(e.GetAngularVelocity().GetX(),e.GetAngularVelocity().GetY(),n.toRad(t)))}applyForce(t,e,o,i,s,a){if(this._body===null&&!this._createBody())return;const r=this._body;this._sharedData.bodyInterface.AddForce(r.GetID(),this.getVec3(t,e,o),this.getRVec3(i*this._sharedData.worldInvScale,s*this._sharedData.worldInvScale,a*this._sharedData.worldInvScale),Jolt.EActivation_Activate)}applyForceAtCenter(t,e,o){if(this._body===null&&!this._createBody())return;const i=this._body;this._sharedData.bodyInterface.AddForce(i.GetID(),this.getVec3(t,e,o),Jolt.EActivation_Activate)}applyForceTowardPosition(t,e,o,i){if(this._body===null&&!this._createBody())return;const s=this._body,a=e-s.GetPosition().GetX(),r=o-s.GetPosition().GetY(),d=i-s.GetPosition().GetZ(),l=a*a+r*r+d*d;if(l===0)return;const h=t/l;this._sharedData.bodyInterface.AddForce(s.GetID(),this.getVec3(a*h,r*h,d*h),Jolt.EActivation_Activate)}applyImpulse(t,e,o,i,s,a){if(this._body===null&&!this._createBody())return;const r=this._body;this._sharedData.bodyInterface.AddImpulse(r.GetID(),this.getVec3(t,e,o),this.getRVec3(i*this._sharedData.worldInvScale,s*this._sharedData.worldInvScale,a*this._sharedData.worldInvScale))}applyImpulseAtCenter(t,e,o){if(this._body===null&&!this._createBody())return;const i=this._body;this._sharedData.bodyInterface.AddImpulse(i.GetID(),this.getVec3(t,e,o))}applyImpulseTowardPosition(t,e,o,i,s,a,r){if(this._body===null&&!this._createBody())return;const d=this._body,l=e-s,h=o-a,f=i-r,c=l*l+h*h+f*f;if(c===0)return;const y=t/c;this._sharedData.bodyInterface.AddImpulse(d.GetID(),this.getVec3(l*y,h*y,f*y),this.getRVec3(s*this._sharedData.worldInvScale,a*this._sharedData.worldInvScale,r*this._sharedData.worldInvScale))}applyTorque(t,e,o){if(this._body===null&&!this._createBody())return;const i=this._body;this._sharedData.bodyInterface.AddTorque(i.GetID(),this.getVec3(n.toRad(t),n.toRad(e),n.toRad(o)),Jolt.EActivation_Activate)}applyAngularImpulse(t,e,o){if(this._body===null&&!this._createBody())return;const i=this._body;this._sharedData.bodyInterface.AddAngularImpulse(i.GetID(),this.getVec3(n.toRad(t),n.toRad(e),n.toRad(o)))}getMass(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return 1/t.GetMotionProperties().GetInverseMass()}getInertiaAroundX(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return 1/t.GetMotionProperties().GetInverseInertiaDiagonal().GetX()}getInertiaAroundY(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return 1/t.GetMotionProperties().GetInverseInertiaDiagonal().GetY()}getInertiaAroundZ(){if(this._body===null&&!this._createBody())return 0;const t=this._body;return 1/t.GetMotionProperties().GetInverseInertiaDiagonal().GetZ()}getMassCenterX(){return this._body===null&&!this._createBody()?0:this._body.GetCenterOfMassPosition().GetX()*this._sharedData.worldScale}getMassCenterY(){return this._body===null&&!this._createBody()?0:this._body.GetCenterOfMassPosition().GetY()*this._sharedData.worldScale}getMassCenterZ(){return this._body===null&&!this._createBody()?0:this._body.GetCenterOfMassPosition().GetZ()*this._sharedData.worldScale}onContactBegin(t){this._currentContacts.push(t);let e=this._contactsEndedThisFrame.indexOf(t);e!==-1?this._contactsEndedThisFrame.splice(e,1):this._contactsStartedThisFrame.push(t)}onContactEnd(t){this._contactsEndedThisFrame.push(t);const e=this._currentContacts.indexOf(t);e!==-1&&this._currentContacts.splice(e,1)}canCollideAgainst(t){return(this.getMasksAccordingToBodyType()&t.getLayersAccordingToBodyType())!=0}static areObjectsColliding(t,e,o){const i=t.getBehavior(o);return i?i.collisionChecker.isColliding(e):!1}static hasCollisionStartedBetween(t,e,o){const i=t.getBehavior(o);return i?i.collisionChecker.hasCollisionStartedWith(e):!1}static hasCollisionStoppedBetween(t,e,o){const i=t.getBehavior(o);return i?i.collisionChecker.hasCollisionStoppedWith(e):!1}}n.Physics3DRuntimeBehavior=_,n.registerBehavior("Physics3D::Physics3DBehavior",n.Physics3DRuntimeBehavior),function(e){class u{constructor(i){this.behavior=i}createAndAddBody(){const{behavior:i}=this,{_sharedData:s}=i,a=i.createShape(),r=new Jolt.BodyCreationSettings(a,i.getPhysicsPosition(s.getRVec3(0,0,0)),i.getPhysicsRotation(s.getQuat(0,0,0,1)),i.bodyType==="Static"?Jolt.EMotionType_Static:i.bodyType==="Kinematic"?Jolt.EMotionType_Kinematic:Jolt.EMotionType_Dynamic,i.getBodyLayer());r.mMotionQuality=i.bullet?Jolt.EMotionQuality_LinearCast:Jolt.EMotionQuality_Discrete,r.mAllowedDOFs=i.fixedRotation?Jolt.EAllowedDOFs_TranslationX|Jolt.EAllowedDOFs_TranslationY|Jolt.EAllowedDOFs_TranslationZ:Jolt.EAllowedDOFs_All,r.mFriction=i.friction,r.mRestitution=i.restitution,r.mLinearDamping=i.linearDamping,r.mAngularDamping=i.angularDamping,r.mGravityFactor=i.gravityScale;const d=s.bodyInterface,l=d.CreateBody(r);return Jolt.destroy(r),d.AddBody(l.GetID(),Jolt.EActivation_Activate),l}updateObjectFromBody(){const{behavior:i}=this,{_body:s}=i;s!==null&&s.IsActive()&&(i.moveObjectToPhysicsPosition(s.GetPosition()),i.moveObjectToPhysicsRotation(s.GetRotation()))}updateBodyFromObject(){const{behavior:i}=this,{owner3D:s,_sharedData:a}=i;if(i._body===null&&!i._createBody())return;const r=i._body;(this.behavior._objectOldX!==s.getX()||this.behavior._objectOldY!==s.getY()||this.behavior._objectOldZ!==s.getZ()||this.behavior._objectOldRotationX!==s.getRotationX()||this.behavior._objectOldRotationY!==s.getRotationY()||this.behavior._objectOldRotationZ!==s.getAngle())&&a.bodyInterface.SetPositionAndRotationWhenChanged(r.GetID(),this.behavior.getPhysicsPosition(a.getRVec3(0,0,0)),this.behavior.getPhysicsRotation(a.getQuat(0,0,0,1)),Jolt.EActivation_Activate)}recreateShape(){const{behavior:i}=this,{_sharedData:s}=i;if(i._body===null&&!i._createBody())return;const a=i._body;s.bodyInterface.SetShape(a.GetID(),i.createShape(),!0,Jolt.EActivation_Activate)}}e.DefaultBodyUpdater=u;class t{constructor(i){this.behavior=i}isColliding(i){return this.behavior._currentContacts.some(s=>s.owner===i)?!0:this.behavior._contactsStartedThisFrame.some(s=>s.owner===i)}hasCollisionStartedWith(i){return this.behavior._contactsStartedThisFrame.some(s=>s.owner===i)}hasCollisionStoppedWith(i){return this.behavior._contactsEndedThisFrame.some(s=>s.owner===i)}}e.DefaultCollisionChecker=t}(_=n.Physics3DRuntimeBehavior||(n.Physics3DRuntimeBehavior={}))})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=Physics3DRuntimeBehavior.js.map
|