x_ite 11.3.0 → 11.3.2
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/README.md +4 -4
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +33 -22
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +4 -7
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +2 -2
- package/dist/assets/components/Geometry2DComponent.min.js +2 -2
- package/dist/assets/components/GeospatialComponent.js +182 -194
- package/dist/assets/components/GeospatialComponent.min.js +2 -2
- package/dist/assets/components/HAnimComponent.js +2 -2
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +3 -3
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +25 -9
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +3 -3
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +8 -8
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
- package/dist/assets/components/PickingComponent.js +71 -109
- package/dist/assets/components/PickingComponent.min.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.js +207 -188
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +2 -2
- package/dist/assets/components/ScriptingComponent.min.js +2 -2
- package/dist/assets/components/TextComponent.js +6 -6
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +105 -105
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
- package/dist/assets/components/WebXRComponent.js +3 -3
- package/dist/assets/components/WebXRComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +5 -5
- package/dist/assets/components/X_ITEComponent.min.js +2 -2
- package/dist/assets/images/XR.svg +1 -92
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +54071 -54010
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +56735 -56674
- package/dist/x_ite.zip +0 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v11.3.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.3.
|
|
1
|
+
/* X_ITE v11.3.2 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.3.2")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ var __webpack_modules__ = ({
|
|
5
5
|
|
|
@@ -536,10 +536,8 @@ Object .assign (Object .setPrototypeOf (BallJoint .prototype, RigidBodyPhysics_X
|
|
|
536
536
|
{
|
|
537
537
|
this .outputs .clear ();
|
|
538
538
|
|
|
539
|
-
for (
|
|
539
|
+
for (const value of this ._forceOutput)
|
|
540
540
|
{
|
|
541
|
-
var value = this ._forceOutput [i];
|
|
542
|
-
|
|
543
541
|
if (value == "ALL")
|
|
544
542
|
{
|
|
545
543
|
this .outputs .add ("body1AnchorPoint");
|
|
@@ -557,7 +555,7 @@ Object .assign (Object .setPrototypeOf (BallJoint .prototype, RigidBodyPhysics_X
|
|
|
557
555
|
{
|
|
558
556
|
if (this .joint)
|
|
559
557
|
{
|
|
560
|
-
|
|
558
|
+
const
|
|
561
559
|
localAnchorPoint1 = this .localAnchorPoint1,
|
|
562
560
|
localAnchorPoint2 = this .localAnchorPoint2;
|
|
563
561
|
|
|
@@ -570,7 +568,7 @@ Object .assign (Object .setPrototypeOf (BallJoint .prototype, RigidBodyPhysics_X
|
|
|
570
568
|
},
|
|
571
569
|
update1: (() =>
|
|
572
570
|
{
|
|
573
|
-
|
|
571
|
+
const localAnchorPoint1 = new (external_X_ITE_X3D_Vector3_default()) ();
|
|
574
572
|
|
|
575
573
|
return function ()
|
|
576
574
|
{
|
|
@@ -580,7 +578,7 @@ Object .assign (Object .setPrototypeOf (BallJoint .prototype, RigidBodyPhysics_X
|
|
|
580
578
|
})(),
|
|
581
579
|
update2: (() =>
|
|
582
580
|
{
|
|
583
|
-
|
|
581
|
+
const localAnchorPoint2 = new (external_X_ITE_X3D_Vector3_default()) ();
|
|
584
582
|
|
|
585
583
|
return function ()
|
|
586
584
|
{
|
|
@@ -691,6 +689,8 @@ function X3DNBodyCollidableNode (executionContext)
|
|
|
691
689
|
(external_X_ITE_X3D_X3DConstants_default()).outputOnly, "compoundShape", new (external_X_ITE_X3D_Fields_default()).SFTime (),
|
|
692
690
|
(external_X_ITE_X3D_X3DConstants_default()).outputOnly, "rebuild", new (external_X_ITE_X3D_Fields_default()).SFTime ());
|
|
693
691
|
|
|
692
|
+
|
|
693
|
+
this .setBoundedObject (true);
|
|
694
694
|
this .setPointingObject (true);
|
|
695
695
|
this .setCollisionObject (true);
|
|
696
696
|
this .setShadowObject (true);
|
|
@@ -715,7 +715,8 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
715
715
|
external_X_ITE_X3D_X3DChildNode_default().prototype .initialize .call (this);
|
|
716
716
|
external_X_ITE_X3D_X3DBoundedObject_default().prototype .initialize .call (this);
|
|
717
717
|
|
|
718
|
-
this ._rebuild
|
|
718
|
+
this ._rebuild .addInterest ("set_child__", this);
|
|
719
|
+
this ._bboxSize .addInterest ("set_boundedObjects__", this);
|
|
719
720
|
|
|
720
721
|
this .addInterest ("eventsProcessed", this);
|
|
721
722
|
|
|
@@ -724,13 +725,13 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
724
725
|
getBBox (bbox, shadows)
|
|
725
726
|
{
|
|
726
727
|
if (this .isDefaultBBoxSize ())
|
|
727
|
-
return this .
|
|
728
|
+
return this .boundedObject ?.getBBox (bbox, shadows) .multRight (this .matrix) ?? bbox .set ();
|
|
728
729
|
|
|
729
730
|
return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ());
|
|
730
731
|
},
|
|
731
732
|
getLocalTransform: (() =>
|
|
732
733
|
{
|
|
733
|
-
|
|
734
|
+
const
|
|
734
735
|
m = new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
735
736
|
o = new AmmoClass .btVector3 (0, 0, 0),
|
|
736
737
|
l = new AmmoClass .btTransform ();
|
|
@@ -789,6 +790,7 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
789
790
|
{
|
|
790
791
|
const childNode = this .childNode;
|
|
791
792
|
|
|
793
|
+
childNode ._isBoundedObject .removeInterest ("requestRebuild", this);
|
|
792
794
|
childNode ._isPointingObject .removeInterest ("requestRebuild", this);
|
|
793
795
|
childNode ._isCameraObject .removeInterest ("requestRebuild", this);
|
|
794
796
|
childNode ._isPickableObject .removeInterest ("requestRebuild", this);
|
|
@@ -805,19 +807,21 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
805
807
|
|
|
806
808
|
// Clear node.
|
|
807
809
|
|
|
808
|
-
this .childNode
|
|
809
|
-
this .
|
|
810
|
+
this .childNode = null;
|
|
811
|
+
this .boundedObject = null;
|
|
812
|
+
this .pointingObject = null;
|
|
810
813
|
this .cameraObject = null;
|
|
811
814
|
this .pickableObject = null;
|
|
812
815
|
this .collisionObject = null;
|
|
813
816
|
this .shadowObject = null;
|
|
814
|
-
this .
|
|
815
|
-
this .
|
|
817
|
+
this .visibleObject = null;
|
|
818
|
+
this .bboxObject = null;
|
|
816
819
|
|
|
817
820
|
// Add node.
|
|
818
821
|
|
|
819
822
|
if (childNode)
|
|
820
823
|
{
|
|
824
|
+
childNode ._isBoundedObject .addInterest ("requestRebuild", this);
|
|
821
825
|
childNode ._isPointingObject .addInterest ("requestRebuild", this);
|
|
822
826
|
childNode ._isCameraObject .addInterest ("requestRebuild", this);
|
|
823
827
|
childNode ._isPickableObject .addInterest ("requestRebuild", this);
|
|
@@ -829,8 +833,11 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
829
833
|
|
|
830
834
|
if (childNode .isVisible ())
|
|
831
835
|
{
|
|
836
|
+
if (childNode .isBoundedObject ())
|
|
837
|
+
this .boundedObject = childNode;
|
|
838
|
+
|
|
832
839
|
if (childNode .isPointingObject ())
|
|
833
|
-
this .
|
|
840
|
+
this .pointingObject = childNode;
|
|
834
841
|
|
|
835
842
|
if (childNode .isCameraObject ())
|
|
836
843
|
this .cameraObject = childNode;
|
|
@@ -845,7 +852,7 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
845
852
|
this .shadowObject = childNode;
|
|
846
853
|
|
|
847
854
|
if (childNode .isVisibleObject ())
|
|
848
|
-
this .
|
|
855
|
+
this .visibleObject = childNode;
|
|
849
856
|
}
|
|
850
857
|
|
|
851
858
|
if (external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DBoundedObject, childNode))
|
|
@@ -854,7 +861,7 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
854
861
|
childNode ._bboxDisplay .addInterest ("requestRebuild", this);
|
|
855
862
|
|
|
856
863
|
if (childNode .isBBoxVisible ())
|
|
857
|
-
this .
|
|
864
|
+
this .bboxObject = childNode;
|
|
858
865
|
}
|
|
859
866
|
|
|
860
867
|
delete this .traverse;
|
|
@@ -864,12 +871,41 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
864
871
|
this .traverse = Function .prototype;
|
|
865
872
|
}
|
|
866
873
|
|
|
867
|
-
this .
|
|
868
|
-
this .
|
|
869
|
-
this .
|
|
874
|
+
this .set_boundedObjects__ ();
|
|
875
|
+
this .set_pointingObjects__ ();
|
|
876
|
+
this .set_cameraObjects__ ();
|
|
877
|
+
this .set_pickableObjects__ ();
|
|
878
|
+
this .set_collisionObjects__ ();
|
|
879
|
+
this .set_shadowObjects__ ();
|
|
880
|
+
this .set_visibleObjects__ ();
|
|
881
|
+
},
|
|
882
|
+
set_boundedObjects__ ()
|
|
883
|
+
{
|
|
884
|
+
this .setBoundedObject (this .boundedObject || !this .isDefaultBBoxSize ());
|
|
885
|
+
},
|
|
886
|
+
set_pointingObjects__ ()
|
|
887
|
+
{
|
|
888
|
+
this .setPointingObject (this .pointingObject);
|
|
889
|
+
},
|
|
890
|
+
set_cameraObjects__ ()
|
|
891
|
+
{
|
|
892
|
+
this .setCameraObject (this .cameraObject);
|
|
893
|
+
},
|
|
894
|
+
set_pickableObjects__ ()
|
|
895
|
+
{
|
|
896
|
+
this .setPickableObject (this .pickableObject);
|
|
897
|
+
},
|
|
898
|
+
set_collisionObjects__ ()
|
|
899
|
+
{
|
|
870
900
|
this .setCollisionObject (this .collisionObject);
|
|
871
|
-
|
|
872
|
-
|
|
901
|
+
},
|
|
902
|
+
set_shadowObjects__ ()
|
|
903
|
+
{
|
|
904
|
+
this .setShadowObject (this .shadowObject);
|
|
905
|
+
},
|
|
906
|
+
set_visibleObjects__ ()
|
|
907
|
+
{
|
|
908
|
+
this .setVisibleObject (this .visibleObject || this .bboxObject || !this .isDefaultBBoxSize ());
|
|
873
909
|
},
|
|
874
910
|
requestRebuild ()
|
|
875
911
|
{
|
|
@@ -896,7 +932,7 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
896
932
|
{
|
|
897
933
|
case (external_X_ITE_X3D_TraverseType_default()).POINTER:
|
|
898
934
|
{
|
|
899
|
-
this .
|
|
935
|
+
this .pointingObject ?.traverse (type, renderObject);
|
|
900
936
|
break;
|
|
901
937
|
}
|
|
902
938
|
case (external_X_ITE_X3D_TraverseType_default()).CAMERA:
|
|
@@ -906,18 +942,16 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
906
942
|
}
|
|
907
943
|
case (external_X_ITE_X3D_TraverseType_default()).PICKING:
|
|
908
944
|
{
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
pickingHierarchy = browser .getPickingHierarchy ();
|
|
945
|
+
// X3DNBodyCollidableNode cannot be pickTarget of a X3DPickSensorNode,
|
|
946
|
+
// so we do not need to a this node to pickingHierarchy.
|
|
912
947
|
|
|
913
|
-
|
|
948
|
+
const browser = this .getBrowser ();
|
|
914
949
|
|
|
915
950
|
if (browser .getPickable () .at (-1))
|
|
916
|
-
this .
|
|
951
|
+
this .visibleObject ?.traverse (type, renderObject);
|
|
917
952
|
else
|
|
918
953
|
this .pickableObject ?.traverse (type, renderObject);
|
|
919
954
|
|
|
920
|
-
pickingHierarchy .pop ();
|
|
921
955
|
break;
|
|
922
956
|
}
|
|
923
957
|
case (external_X_ITE_X3D_TraverseType_default()).COLLISION:
|
|
@@ -932,8 +966,8 @@ Object .assign (Object .setPrototypeOf (X3DNBodyCollidableNode .prototype, (exte
|
|
|
932
966
|
}
|
|
933
967
|
case (external_X_ITE_X3D_TraverseType_default()).DISPLAY:
|
|
934
968
|
{
|
|
935
|
-
this .
|
|
936
|
-
this .
|
|
969
|
+
this .visibleObject ?.traverse (type, renderObject);
|
|
970
|
+
this .bboxObject ?.displayBBox (type, renderObject);
|
|
937
971
|
break;
|
|
938
972
|
}
|
|
939
973
|
}
|
|
@@ -1502,19 +1536,19 @@ const CollidableShape_default_ = CollidableShape;
|
|
|
1502
1536
|
*
|
|
1503
1537
|
******************************************************************************/
|
|
1504
1538
|
|
|
1505
|
-
let
|
|
1539
|
+
let AppliedParametersType_i = 0;
|
|
1506
1540
|
|
|
1507
1541
|
const AppliedParametersType =
|
|
1508
1542
|
{
|
|
1509
|
-
BOUNCE:
|
|
1510
|
-
USER_FRICTION:
|
|
1511
|
-
FRICTION_COEFFICIENT_2:
|
|
1512
|
-
ERROR_REDUCTION:
|
|
1513
|
-
CONSTANT_FORCE:
|
|
1514
|
-
SPEED_1:
|
|
1515
|
-
SPEED_2:
|
|
1516
|
-
SLIP_1:
|
|
1517
|
-
SLIP_2:
|
|
1543
|
+
BOUNCE: AppliedParametersType_i ++,
|
|
1544
|
+
USER_FRICTION: AppliedParametersType_i ++,
|
|
1545
|
+
FRICTION_COEFFICIENT_2: AppliedParametersType_i ++,
|
|
1546
|
+
ERROR_REDUCTION: AppliedParametersType_i ++,
|
|
1547
|
+
CONSTANT_FORCE: AppliedParametersType_i ++,
|
|
1548
|
+
SPEED_1: AppliedParametersType_i ++,
|
|
1549
|
+
SPEED_2: AppliedParametersType_i ++,
|
|
1550
|
+
SLIP_1: AppliedParametersType_i ++,
|
|
1551
|
+
SLIP_2: AppliedParametersType_i ++,
|
|
1518
1552
|
};
|
|
1519
1553
|
|
|
1520
1554
|
const AppliedParametersType_default_ = AppliedParametersType;
|
|
@@ -1593,7 +1627,7 @@ function CollisionCollection (executionContext)
|
|
|
1593
1627
|
this ._softnessConstantForceMix .setUnit ("force");
|
|
1594
1628
|
|
|
1595
1629
|
// Private properties
|
|
1596
|
-
|
|
1630
|
+
|
|
1597
1631
|
this .appliedParameters = new Set ();
|
|
1598
1632
|
this .collidableNodes = [ ];
|
|
1599
1633
|
this .collisionSpaceNodes = [ ];
|
|
@@ -1627,7 +1661,7 @@ Object .assign (Object .setPrototypeOf (CollisionCollection .prototype, (externa
|
|
|
1627
1661
|
},
|
|
1628
1662
|
set_appliedParameters__: (() =>
|
|
1629
1663
|
{
|
|
1630
|
-
|
|
1664
|
+
const appliedParametersIndex = new Map ([
|
|
1631
1665
|
["BOUNCE", RigidBodyPhysics_AppliedParametersType .BOUNCE],
|
|
1632
1666
|
["USER_FRICTION", RigidBodyPhysics_AppliedParametersType .USER_FRICTION],
|
|
1633
1667
|
["FRICTION_COEFFICIENT-2", RigidBodyPhysics_AppliedParametersType .FRICTION_COEFFICIENT_2],
|
|
@@ -1643,27 +1677,27 @@ Object .assign (Object .setPrototypeOf (CollisionCollection .prototype, (externa
|
|
|
1643
1677
|
{
|
|
1644
1678
|
this .appliedParameters .clear ();
|
|
1645
1679
|
|
|
1646
|
-
for (
|
|
1680
|
+
for (const appliedParameter of this ._appliedParameters)
|
|
1647
1681
|
{
|
|
1648
|
-
|
|
1682
|
+
const value = appliedParametersIndex .get (appliedParameter);
|
|
1649
1683
|
|
|
1650
|
-
if (
|
|
1651
|
-
this .appliedParameters .add (
|
|
1684
|
+
if (value !== undefined)
|
|
1685
|
+
this .appliedParameters .add (value);
|
|
1652
1686
|
}
|
|
1653
1687
|
};
|
|
1654
1688
|
})(),
|
|
1655
1689
|
set_collidables__ ()
|
|
1656
1690
|
{
|
|
1657
|
-
|
|
1691
|
+
const collisionSpaceNodes = this .collisionSpaceNodes;
|
|
1658
1692
|
|
|
1659
|
-
for (
|
|
1660
|
-
|
|
1693
|
+
for (const collisionSpaceNode of collisionSpaceNodes)
|
|
1694
|
+
collisionSpaceNode .removeInterest ("collect", this);
|
|
1661
1695
|
|
|
1662
1696
|
collisionSpaceNodes .length = 0;
|
|
1663
1697
|
|
|
1664
|
-
for (
|
|
1698
|
+
for (const node of this ._collidables)
|
|
1665
1699
|
{
|
|
1666
|
-
|
|
1700
|
+
const collisionSpaceNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DNBodyCollisionSpaceNode, node);
|
|
1667
1701
|
|
|
1668
1702
|
if (collisionSpaceNode)
|
|
1669
1703
|
{
|
|
@@ -1677,16 +1711,16 @@ Object .assign (Object .setPrototypeOf (CollisionCollection .prototype, (externa
|
|
|
1677
1711
|
},
|
|
1678
1712
|
collect ()
|
|
1679
1713
|
{
|
|
1680
|
-
|
|
1714
|
+
const
|
|
1681
1715
|
collidableNodes = this .collidableNodes,
|
|
1682
1716
|
collisionSpaceNodes = this .collisionSpaceNodes;
|
|
1683
1717
|
|
|
1684
1718
|
collidableNodes .length = 0;
|
|
1685
1719
|
collisionSpaceNodes .length = 0;
|
|
1686
1720
|
|
|
1687
|
-
for (
|
|
1721
|
+
for (const node of this ._collidables)
|
|
1688
1722
|
{
|
|
1689
|
-
|
|
1723
|
+
const collidableNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DNBodyCollidableNode, node);
|
|
1690
1724
|
|
|
1691
1725
|
if (collidableNode)
|
|
1692
1726
|
{
|
|
@@ -1694,7 +1728,7 @@ Object .assign (Object .setPrototypeOf (CollisionCollection .prototype, (externa
|
|
|
1694
1728
|
continue;
|
|
1695
1729
|
}
|
|
1696
1730
|
|
|
1697
|
-
|
|
1731
|
+
const collisionSpaceNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DNBodyCollisionSpaceNode, node);
|
|
1698
1732
|
|
|
1699
1733
|
if (collisionSpaceNode)
|
|
1700
1734
|
{
|
|
@@ -1843,7 +1877,7 @@ Object .assign (Object .setPrototypeOf (CollisionSensor .prototype, (external_X_
|
|
|
1843
1877
|
},
|
|
1844
1878
|
update: (() =>
|
|
1845
1879
|
{
|
|
1846
|
-
|
|
1880
|
+
const
|
|
1847
1881
|
collidableNodesIndex = new Map (),
|
|
1848
1882
|
collisionWorlds = new Set (),
|
|
1849
1883
|
intersectionNodes = new Set (),
|
|
@@ -1853,24 +1887,22 @@ Object .assign (Object .setPrototypeOf (CollisionSensor .prototype, (external_X_
|
|
|
1853
1887
|
|
|
1854
1888
|
return function ()
|
|
1855
1889
|
{
|
|
1856
|
-
|
|
1890
|
+
const
|
|
1857
1891
|
colliderNode = this .colliderNode,
|
|
1858
1892
|
collidableNodes = colliderNode .getCollidables ();
|
|
1859
1893
|
|
|
1860
1894
|
collidableNodesIndex .clear ();
|
|
1861
1895
|
collisionWorlds .clear ();
|
|
1862
1896
|
|
|
1863
|
-
for (
|
|
1897
|
+
for (const collidableNode of collidableNodes)
|
|
1864
1898
|
{
|
|
1865
|
-
|
|
1866
|
-
collidableNode = collidableNodes [i],
|
|
1867
|
-
bodyNode = collidableNodes [i] .getBody ();
|
|
1899
|
+
const bodyNode = collidableNode .getBody ();
|
|
1868
1900
|
|
|
1869
1901
|
if (bodyNode)
|
|
1870
1902
|
{
|
|
1871
1903
|
collidableNodesIndex .set (bodyNode .getRigidBody () .ptr, collidableNode);
|
|
1872
1904
|
|
|
1873
|
-
|
|
1905
|
+
const collection = bodyNode .getCollection ();
|
|
1874
1906
|
|
|
1875
1907
|
if (collection)
|
|
1876
1908
|
collisionWorlds .add (collection .getDynamicsWorld ());
|
|
@@ -1884,32 +1916,32 @@ Object .assign (Object .setPrototypeOf (CollisionSensor .prototype, (external_X_
|
|
|
1884
1916
|
{
|
|
1885
1917
|
//collisionWorld .performDiscreteCollisionDetection ();
|
|
1886
1918
|
|
|
1887
|
-
|
|
1919
|
+
const
|
|
1888
1920
|
dispatcher = collisionWorld .getDispatcher (),
|
|
1889
1921
|
numManifolds = dispatcher .getNumManifolds ();
|
|
1890
1922
|
|
|
1891
|
-
for (
|
|
1923
|
+
for (let i = 0; i < numManifolds; ++ i)
|
|
1892
1924
|
{
|
|
1893
|
-
|
|
1925
|
+
const
|
|
1894
1926
|
contactManifold = dispatcher .getManifoldByIndexInternal (i),
|
|
1895
1927
|
numContacts = contactManifold .getNumContacts ();
|
|
1896
1928
|
|
|
1897
|
-
for (
|
|
1929
|
+
for (let j = 0; j < numContacts; ++ j)
|
|
1898
1930
|
{
|
|
1899
|
-
|
|
1931
|
+
const pt = contactManifold .getContactPoint (j);
|
|
1900
1932
|
|
|
1901
1933
|
if (pt .getDistance () <= 0)
|
|
1902
1934
|
{
|
|
1903
|
-
|
|
1935
|
+
const
|
|
1904
1936
|
collidableNode1 = collidableNodesIndex .get (contactManifold .getBody0 () .ptr),
|
|
1905
1937
|
collidableNode2 = collidableNodesIndex .get (contactManifold .getBody1 () .ptr);
|
|
1906
1938
|
|
|
1907
1939
|
if (! collidableNode1 && ! collidableNode2)
|
|
1908
1940
|
continue;
|
|
1909
1941
|
|
|
1910
|
-
|
|
1942
|
+
const contactNode = this .getContact (contactNodes .length);
|
|
1911
1943
|
|
|
1912
|
-
|
|
1944
|
+
const
|
|
1913
1945
|
btPosition = pt .getPositionWorldOnA (),
|
|
1914
1946
|
btContactNormal = pt .get_m_normalWorldOnB ();
|
|
1915
1947
|
|
|
@@ -1948,14 +1980,14 @@ Object .assign (Object .setPrototypeOf (CollisionSensor .prototype, (external_X_
|
|
|
1948
1980
|
}
|
|
1949
1981
|
});
|
|
1950
1982
|
|
|
1951
|
-
|
|
1983
|
+
const active = !! contactNodes .length;
|
|
1952
1984
|
|
|
1953
1985
|
if (this ._isActive .getValue () !== active)
|
|
1954
1986
|
this ._isActive = active;
|
|
1955
1987
|
|
|
1956
1988
|
if (intersectionNodes .size)
|
|
1957
1989
|
{
|
|
1958
|
-
|
|
1990
|
+
let i = 0;
|
|
1959
1991
|
|
|
1960
1992
|
intersectionNodes .forEach (intersectionNode => this ._intersections [i ++] = intersectionNode);
|
|
1961
1993
|
|
|
@@ -1964,7 +1996,7 @@ Object .assign (Object .setPrototypeOf (CollisionSensor .prototype, (external_X_
|
|
|
1964
1996
|
|
|
1965
1997
|
if (contactNodes .length)
|
|
1966
1998
|
{
|
|
1967
|
-
|
|
1999
|
+
let i = 0;
|
|
1968
2000
|
|
|
1969
2001
|
contactNodes .forEach (contactNode => this ._contacts [i ++] = contactNode);
|
|
1970
2002
|
|
|
@@ -2184,16 +2216,16 @@ Object .assign (Object .setPrototypeOf (CollisionSpace .prototype, RigidBodyPhys
|
|
|
2184
2216
|
},
|
|
2185
2217
|
set_collidables__ ()
|
|
2186
2218
|
{
|
|
2187
|
-
|
|
2219
|
+
const collisionSpaceNodes = this .collisionSpaceNodes;
|
|
2188
2220
|
|
|
2189
|
-
for (
|
|
2190
|
-
|
|
2221
|
+
for (const collisionSpaceNode of collisionSpaceNodes)
|
|
2222
|
+
collisionSpaceNode .removeInterest ("collect", this);
|
|
2191
2223
|
|
|
2192
2224
|
collisionSpaceNodes .length = 0;
|
|
2193
2225
|
|
|
2194
|
-
for (
|
|
2226
|
+
for (const node of this ._collidables)
|
|
2195
2227
|
{
|
|
2196
|
-
|
|
2228
|
+
const collisionSpaceNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DNBodyCollisionSpaceNode, node);
|
|
2197
2229
|
|
|
2198
2230
|
if (collisionSpaceNode)
|
|
2199
2231
|
{
|
|
@@ -2207,16 +2239,16 @@ Object .assign (Object .setPrototypeOf (CollisionSpace .prototype, RigidBodyPhys
|
|
|
2207
2239
|
},
|
|
2208
2240
|
collect ()
|
|
2209
2241
|
{
|
|
2210
|
-
|
|
2242
|
+
const
|
|
2211
2243
|
collidableNodes = this .collidableNodes,
|
|
2212
2244
|
collisionSpaceNodes = this .collisionSpaceNodes;
|
|
2213
2245
|
|
|
2214
2246
|
collidableNodes .length = 0;
|
|
2215
2247
|
collisionSpaceNodes .length = 0;
|
|
2216
2248
|
|
|
2217
|
-
for (
|
|
2249
|
+
for (const node of this ._collidables)
|
|
2218
2250
|
{
|
|
2219
|
-
|
|
2251
|
+
const collidableNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DNBodyCollidableNode, node);
|
|
2220
2252
|
|
|
2221
2253
|
if (collidableNode)
|
|
2222
2254
|
{
|
|
@@ -2224,7 +2256,7 @@ Object .assign (Object .setPrototypeOf (CollisionSpace .prototype, RigidBodyPhys
|
|
|
2224
2256
|
continue;
|
|
2225
2257
|
}
|
|
2226
2258
|
|
|
2227
|
-
|
|
2259
|
+
const collisionSpaceNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DNBodyCollisionSpaceNode, this ._collidables [i]);
|
|
2228
2260
|
|
|
2229
2261
|
if (collisionSpaceNode)
|
|
2230
2262
|
{
|
|
@@ -2475,7 +2507,7 @@ Object .assign (Object .setPrototypeOf (DoubleAxisHingeJoint .prototype, RigidBo
|
|
|
2475
2507
|
},
|
|
2476
2508
|
addJoint: (() =>
|
|
2477
2509
|
{
|
|
2478
|
-
|
|
2510
|
+
const
|
|
2479
2511
|
localAnchorPoint1 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
2480
2512
|
localAnchorPoint2 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
2481
2513
|
localAxis1 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
@@ -2533,10 +2565,8 @@ Object .assign (Object .setPrototypeOf (DoubleAxisHingeJoint .prototype, RigidBo
|
|
|
2533
2565
|
{
|
|
2534
2566
|
this .outputs .clear ();
|
|
2535
2567
|
|
|
2536
|
-
for (
|
|
2568
|
+
for (const value of this ._forceOutput)
|
|
2537
2569
|
{
|
|
2538
|
-
var value = this ._forceOutput [i];
|
|
2539
|
-
|
|
2540
2570
|
if (value == "ALL")
|
|
2541
2571
|
{
|
|
2542
2572
|
this .outputs .add ("body1AnchorPoint");
|
|
@@ -2558,7 +2588,7 @@ Object .assign (Object .setPrototypeOf (DoubleAxisHingeJoint .prototype, RigidBo
|
|
|
2558
2588
|
},
|
|
2559
2589
|
update1: (() =>
|
|
2560
2590
|
{
|
|
2561
|
-
|
|
2591
|
+
const
|
|
2562
2592
|
localAnchorPoint1 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
2563
2593
|
localAxis1 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
2564
2594
|
difference = new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
@@ -2574,7 +2604,7 @@ Object .assign (Object .setPrototypeOf (DoubleAxisHingeJoint .prototype, RigidBo
|
|
|
2574
2604
|
|
|
2575
2605
|
if (this .outputs .has ("hinge1Angle"))
|
|
2576
2606
|
{
|
|
2577
|
-
|
|
2607
|
+
const lastAngle = this ._hinge1Angle .getValue ();
|
|
2578
2608
|
|
|
2579
2609
|
difference .assign (this .getInitialInverseMatrix1 ()) .multRight (this .getBody1 () .getMatrix ());
|
|
2580
2610
|
difference .get (null, rotation);
|
|
@@ -2588,7 +2618,7 @@ Object .assign (Object .setPrototypeOf (DoubleAxisHingeJoint .prototype, RigidBo
|
|
|
2588
2618
|
})(),
|
|
2589
2619
|
update2: (() =>
|
|
2590
2620
|
{
|
|
2591
|
-
|
|
2621
|
+
const
|
|
2592
2622
|
localAnchorPoint2 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
2593
2623
|
localAxis2 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
2594
2624
|
difference = new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
@@ -2604,7 +2634,7 @@ Object .assign (Object .setPrototypeOf (DoubleAxisHingeJoint .prototype, RigidBo
|
|
|
2604
2634
|
|
|
2605
2635
|
if (this .outputs .has ("hinge2Angle"))
|
|
2606
2636
|
{
|
|
2607
|
-
|
|
2637
|
+
const lastAngle = this ._hinge2Angle .getValue ();
|
|
2608
2638
|
|
|
2609
2639
|
difference .assign (this .getInitialInverseMatrix2 ()) .multRight (this .getBody2 () .getMatrix ());
|
|
2610
2640
|
difference .get (null, rotation);
|
|
@@ -2946,17 +2976,17 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
2946
2976
|
},
|
|
2947
2977
|
set_position__ ()
|
|
2948
2978
|
{
|
|
2949
|
-
for (
|
|
2950
|
-
|
|
2979
|
+
for (const geometryNode of this .geometryNodes)
|
|
2980
|
+
geometryNode ._translation = this ._position;
|
|
2951
2981
|
},
|
|
2952
2982
|
set_orientation__ ()
|
|
2953
2983
|
{
|
|
2954
|
-
for (
|
|
2955
|
-
|
|
2984
|
+
for (const geometryNode of this .geometryNodes)
|
|
2985
|
+
geometryNode ._rotation = this ._orientation;
|
|
2956
2986
|
},
|
|
2957
2987
|
set_transform__: (() =>
|
|
2958
2988
|
{
|
|
2959
|
-
|
|
2989
|
+
const
|
|
2960
2990
|
o = new AmmoClass .btVector3 (0, 0, 0),
|
|
2961
2991
|
t = new AmmoClass .btTransform (),
|
|
2962
2992
|
im = new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
@@ -2965,7 +2995,7 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
2965
2995
|
|
|
2966
2996
|
return function ()
|
|
2967
2997
|
{
|
|
2968
|
-
|
|
2998
|
+
const m = this .matrix;
|
|
2969
2999
|
|
|
2970
3000
|
m .set (this ._position .getValue (), this ._orientation .getValue ());
|
|
2971
3001
|
|
|
@@ -2994,9 +3024,9 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
2994
3024
|
|
|
2995
3025
|
it .setOrigin (io);
|
|
2996
3026
|
|
|
2997
|
-
|
|
3027
|
+
const compoundShape = this .compoundShape;
|
|
2998
3028
|
|
|
2999
|
-
for (
|
|
3029
|
+
for (let i = 0, length = this .compoundShape .getNumChildShapes (); i < length; ++ i)
|
|
3000
3030
|
compoundShape .updateChildTransform (i, it, false);
|
|
3001
3031
|
|
|
3002
3032
|
this .compoundShape .recalculateLocalAabb ();
|
|
@@ -3007,7 +3037,7 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3007
3037
|
})(),
|
|
3008
3038
|
set_linearVelocity__: (() =>
|
|
3009
3039
|
{
|
|
3010
|
-
|
|
3040
|
+
const lv = new AmmoClass .btVector3 (0, 0, 0);
|
|
3011
3041
|
|
|
3012
3042
|
return function ()
|
|
3013
3043
|
{
|
|
@@ -3022,7 +3052,7 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3022
3052
|
}) (),
|
|
3023
3053
|
set_angularVelocity__: (() =>
|
|
3024
3054
|
{
|
|
3025
|
-
|
|
3055
|
+
const av = new AmmoClass .btVector3 (0, 0, 0);
|
|
3026
3056
|
|
|
3027
3057
|
return function ()
|
|
3028
3058
|
{
|
|
@@ -3037,7 +3067,7 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3037
3067
|
})(),
|
|
3038
3068
|
set_finiteRotationAxis__: (() =>
|
|
3039
3069
|
{
|
|
3040
|
-
|
|
3070
|
+
const angularFactor = new AmmoClass .btVector3 (1, 1, 1);
|
|
3041
3071
|
|
|
3042
3072
|
return function ()
|
|
3043
3073
|
{
|
|
@@ -3060,7 +3090,7 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3060
3090
|
},
|
|
3061
3091
|
set_centerOfMass__: (() =>
|
|
3062
3092
|
{
|
|
3063
|
-
|
|
3093
|
+
const
|
|
3064
3094
|
rotation = new AmmoClass .btQuaternion (0, 0, 0, 1),
|
|
3065
3095
|
origin = new AmmoClass .btVector3 (0, 0, 0),
|
|
3066
3096
|
centerOfMass = new AmmoClass .btTransform (rotation, origin);
|
|
@@ -3075,11 +3105,11 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3075
3105
|
})(),
|
|
3076
3106
|
set_massProps__: (() =>
|
|
3077
3107
|
{
|
|
3078
|
-
|
|
3108
|
+
const localInertia = new AmmoClass .btVector3 (0, 0, 0);
|
|
3079
3109
|
|
|
3080
3110
|
return function ()
|
|
3081
3111
|
{
|
|
3082
|
-
|
|
3112
|
+
const inertia = this ._inertia;
|
|
3083
3113
|
|
|
3084
3114
|
localInertia .setValue (inertia [0] + inertia [1] + inertia [2],
|
|
3085
3115
|
inertia [3] + inertia [4] + inertia [5],
|
|
@@ -3094,15 +3124,15 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3094
3124
|
{
|
|
3095
3125
|
this .force .set (0, 0, 0);
|
|
3096
3126
|
|
|
3097
|
-
for (
|
|
3098
|
-
this .force .add (
|
|
3127
|
+
for (const force of this ._forces)
|
|
3128
|
+
this .force .add (force .getValue ());
|
|
3099
3129
|
},
|
|
3100
3130
|
set_torques__ ()
|
|
3101
3131
|
{
|
|
3102
3132
|
this .torque .set (0, 0, 0);
|
|
3103
3133
|
|
|
3104
|
-
for (
|
|
3105
|
-
this .torque .add (
|
|
3134
|
+
for (const torque of this ._torques)
|
|
3135
|
+
this .torque .add (torque .getValue ());
|
|
3106
3136
|
},
|
|
3107
3137
|
set_disable__ ()
|
|
3108
3138
|
{
|
|
@@ -3117,12 +3147,10 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3117
3147
|
},
|
|
3118
3148
|
set_geometry__ ()
|
|
3119
3149
|
{
|
|
3120
|
-
|
|
3150
|
+
const geometryNodes = this .geometryNodes;
|
|
3121
3151
|
|
|
3122
|
-
for (
|
|
3152
|
+
for (const geometryNode of geometryNodes)
|
|
3123
3153
|
{
|
|
3124
|
-
var geometryNode = geometryNodes [i];
|
|
3125
|
-
|
|
3126
3154
|
geometryNode .removeInterest ("addEvent", this ._transform);
|
|
3127
3155
|
geometryNode ._compoundShape .removeInterest ("set_compoundShape__", this);
|
|
3128
3156
|
|
|
@@ -3135,16 +3163,16 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3135
3163
|
this ._orientation .removeFieldInterest (geometryNode ._rotation);
|
|
3136
3164
|
}
|
|
3137
3165
|
|
|
3138
|
-
for (
|
|
3139
|
-
|
|
3166
|
+
for (const otherGeometryNode of this .otherGeometryNodes)
|
|
3167
|
+
otherGeometryNode ._body .removeInterest ("set_body__", this);
|
|
3140
3168
|
|
|
3141
3169
|
geometryNodes .length = 0;
|
|
3142
3170
|
|
|
3143
|
-
for (
|
|
3171
|
+
for (const node of this ._geometry)
|
|
3144
3172
|
{
|
|
3145
|
-
|
|
3173
|
+
const geometryNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DNBodyCollidableNode, node);
|
|
3146
3174
|
|
|
3147
|
-
if (!
|
|
3175
|
+
if (!geometryNode)
|
|
3148
3176
|
continue;
|
|
3149
3177
|
|
|
3150
3178
|
if (geometryNode .getBody ())
|
|
@@ -3159,10 +3187,8 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3159
3187
|
geometryNodes .push (geometryNode);
|
|
3160
3188
|
}
|
|
3161
3189
|
|
|
3162
|
-
for (
|
|
3190
|
+
for (const geometryNode of geometryNodes)
|
|
3163
3191
|
{
|
|
3164
|
-
var geometryNode = geometryNodes [i];
|
|
3165
|
-
|
|
3166
3192
|
geometryNode .addInterest ("addEvent", this ._transform);
|
|
3167
3193
|
geometryNode ._compoundShape .addInterest ("set_compoundShape__", this);
|
|
3168
3194
|
|
|
@@ -3181,17 +3207,17 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3181
3207
|
},
|
|
3182
3208
|
set_compoundShape__: (() =>
|
|
3183
3209
|
{
|
|
3184
|
-
|
|
3210
|
+
const transform = new AmmoClass .btTransform ();
|
|
3185
3211
|
|
|
3186
3212
|
return function ()
|
|
3187
3213
|
{
|
|
3188
|
-
|
|
3214
|
+
const compoundShape = this .compoundShape;
|
|
3189
3215
|
|
|
3190
|
-
for (
|
|
3216
|
+
for (let i = compoundShape .getNumChildShapes () - 1; i >= 0; -- i)
|
|
3191
3217
|
compoundShape .removeChildShapeByIndex (i);
|
|
3192
3218
|
|
|
3193
|
-
for (
|
|
3194
|
-
compoundShape .addChildShape (transform,
|
|
3219
|
+
for (const geometryNode of this .geometryNodes)
|
|
3220
|
+
compoundShape .addChildShape (transform, geometryNode .getCompoundShape ());
|
|
3195
3221
|
|
|
3196
3222
|
this .set_position__ ();
|
|
3197
3223
|
this .set_orientation__ ();
|
|
@@ -3207,7 +3233,7 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3207
3233
|
})(),
|
|
3208
3234
|
applyForces: (() =>
|
|
3209
3235
|
{
|
|
3210
|
-
|
|
3236
|
+
const
|
|
3211
3237
|
g = new AmmoClass .btVector3 (0, 0, 0),
|
|
3212
3238
|
f = new AmmoClass .btVector3 (0, 0, 0),
|
|
3213
3239
|
t = new AmmoClass .btVector3 (0, 0, 0),
|
|
@@ -3233,7 +3259,7 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3233
3259
|
})(),
|
|
3234
3260
|
update: (() =>
|
|
3235
3261
|
{
|
|
3236
|
-
|
|
3262
|
+
const
|
|
3237
3263
|
transform = new AmmoClass .btTransform (),
|
|
3238
3264
|
position = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
3239
3265
|
quaternion = new (external_X_ITE_X3D_Quaternion_default()) (),
|
|
@@ -3245,7 +3271,7 @@ Object .assign (Object .setPrototypeOf (RigidBody .prototype, (external_X_ITE_X3
|
|
|
3245
3271
|
{
|
|
3246
3272
|
this .motionState .getWorldTransform (transform);
|
|
3247
3273
|
|
|
3248
|
-
|
|
3274
|
+
const
|
|
3249
3275
|
btOrigin = transform .getOrigin (),
|
|
3250
3276
|
btQuaternion = transform .getRotation (),
|
|
3251
3277
|
btLinearVeloctity = this .rigidBody .getLinearVelocity (),
|
|
@@ -3439,7 +3465,7 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3439
3465
|
{
|
|
3440
3466
|
const DELAY = 15; // Delay in frames when dt full applies.
|
|
3441
3467
|
|
|
3442
|
-
|
|
3468
|
+
const
|
|
3443
3469
|
dt = 1 / Math .max (10, this .getBrowser () .getCurrentFrameRate ()),
|
|
3444
3470
|
deltaTime = this .deltaTime = ((DELAY - 1) * this .deltaTime + dt) / DELAY; // Moving average about DELAY frames.
|
|
3445
3471
|
|
|
@@ -3457,7 +3483,7 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3457
3483
|
},
|
|
3458
3484
|
set_gravity__: (() =>
|
|
3459
3485
|
{
|
|
3460
|
-
|
|
3486
|
+
const gravity = new AmmoClass .btVector3 (0, 0, 0);
|
|
3461
3487
|
|
|
3462
3488
|
return function ()
|
|
3463
3489
|
{
|
|
@@ -3470,8 +3496,8 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3470
3496
|
})(),
|
|
3471
3497
|
set_contactSurfaceThickness__ ()
|
|
3472
3498
|
{
|
|
3473
|
-
for (
|
|
3474
|
-
|
|
3499
|
+
for (const bodyNode of this .bodyNodes)
|
|
3500
|
+
bodyNode .getRigidBody () .getCollisionShape () .setMargin (this ._contactSurfaceThickness .getValue ());
|
|
3475
3501
|
},
|
|
3476
3502
|
set_collider__ ()
|
|
3477
3503
|
{
|
|
@@ -3479,7 +3505,7 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3479
3505
|
},
|
|
3480
3506
|
set_bounce__ ()
|
|
3481
3507
|
{
|
|
3482
|
-
|
|
3508
|
+
const
|
|
3483
3509
|
colliderNode = this .colliderNode,
|
|
3484
3510
|
bodyNodes = this .bodyNodes;
|
|
3485
3511
|
|
|
@@ -3487,9 +3513,9 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3487
3513
|
{
|
|
3488
3514
|
if (colliderNode .getAppliedParameters () .has (RigidBodyPhysics_AppliedParametersType .BOUNCE))
|
|
3489
3515
|
{
|
|
3490
|
-
for (
|
|
3516
|
+
for (const bodyNode of bodyNodes)
|
|
3491
3517
|
{
|
|
3492
|
-
|
|
3518
|
+
const rigidBody = bodyNode .getRigidBody ();
|
|
3493
3519
|
|
|
3494
3520
|
if (rigidBody .getLinearVelocity () .length () >= colliderNode ._minBounceSpeed .getValue ())
|
|
3495
3521
|
rigidBody .setRestitution (colliderNode ._bounce .getValue ());
|
|
@@ -3501,8 +3527,8 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3501
3527
|
}
|
|
3502
3528
|
}
|
|
3503
3529
|
|
|
3504
|
-
for (
|
|
3505
|
-
|
|
3530
|
+
for (const bodyNode of bodyNodes)
|
|
3531
|
+
bodyNode .getRigidBody () .setRestitution (0);
|
|
3506
3532
|
},
|
|
3507
3533
|
set_frictionCoefficients__ ()
|
|
3508
3534
|
{
|
|
@@ -3510,9 +3536,9 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3510
3536
|
{
|
|
3511
3537
|
if (this .colliderNode .getAppliedParameters () .has (RigidBodyPhysics_AppliedParametersType .FRICTION_COEFFICIENT_2))
|
|
3512
3538
|
{
|
|
3513
|
-
for (
|
|
3539
|
+
for (const bodyNode of this .bodyNodes)
|
|
3514
3540
|
{
|
|
3515
|
-
|
|
3541
|
+
const rigidBody = bodyNode .getRigidBody ();
|
|
3516
3542
|
|
|
3517
3543
|
rigidBody .setFriction (this .colliderNode ._frictionCoefficients .x);
|
|
3518
3544
|
rigidBody .setRollingFriction (this .colliderNode ._frictionCoefficients .y);
|
|
@@ -3522,9 +3548,9 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3522
3548
|
}
|
|
3523
3549
|
}
|
|
3524
3550
|
|
|
3525
|
-
for (
|
|
3551
|
+
for (const bodyNode of this .bodyNodes)
|
|
3526
3552
|
{
|
|
3527
|
-
|
|
3553
|
+
const rigidBody = bodyNode .getRigidBody ();
|
|
3528
3554
|
|
|
3529
3555
|
rigidBody .setFriction (0.5);
|
|
3530
3556
|
rigidBody .setRollingFriction (0);
|
|
@@ -3532,22 +3558,20 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3532
3558
|
},
|
|
3533
3559
|
set_bodies__ ()
|
|
3534
3560
|
{
|
|
3535
|
-
for (
|
|
3561
|
+
for (const bodyNode of this .bodyNodes)
|
|
3536
3562
|
{
|
|
3537
|
-
var bodyNode = this .bodyNodes [i];
|
|
3538
|
-
|
|
3539
3563
|
bodyNode ._enabled .removeInterest ("set_dynamicsWorld__", this);
|
|
3540
3564
|
bodyNode .setCollection (null);
|
|
3541
3565
|
}
|
|
3542
3566
|
|
|
3543
|
-
for (
|
|
3544
|
-
|
|
3567
|
+
for (const otherBodyNode of this .otherBodyNodes)
|
|
3568
|
+
otherBodyNode ._collection .removeInterest ("set_bodies__", this);
|
|
3545
3569
|
|
|
3546
3570
|
this .bodyNodes .length = 0;
|
|
3547
3571
|
|
|
3548
|
-
for (
|
|
3572
|
+
for (const node of this ._bodies)
|
|
3549
3573
|
{
|
|
3550
|
-
|
|
3574
|
+
const bodyNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).RigidBody, node);
|
|
3551
3575
|
|
|
3552
3576
|
if (! bodyNode)
|
|
3553
3577
|
continue;
|
|
@@ -3564,8 +3588,8 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3564
3588
|
this .bodyNodes .push (bodyNode);
|
|
3565
3589
|
}
|
|
3566
3590
|
|
|
3567
|
-
for (
|
|
3568
|
-
|
|
3591
|
+
for (const bodyNode of this .bodyNodes)
|
|
3592
|
+
bodyNode ._enabled .addInterest ("set_dynamicsWorld__", this);
|
|
3569
3593
|
|
|
3570
3594
|
this .set_contactSurfaceThickness__ ();
|
|
3571
3595
|
this .set_dynamicsWorld__ ();
|
|
@@ -3573,39 +3597,37 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3573
3597
|
},
|
|
3574
3598
|
set_dynamicsWorld__ ()
|
|
3575
3599
|
{
|
|
3576
|
-
for (
|
|
3577
|
-
this .dynamicsWorld .removeRigidBody (
|
|
3600
|
+
for (const rigidBody of this .rigidBodies)
|
|
3601
|
+
this .dynamicsWorld .removeRigidBody (rigidBody);
|
|
3578
3602
|
|
|
3579
3603
|
this .rigidBodies .length = 0;
|
|
3580
3604
|
|
|
3581
|
-
for (
|
|
3605
|
+
for (const bodyNode of this .bodyNodes)
|
|
3582
3606
|
{
|
|
3583
|
-
var bodyNode = this .bodyNodes [i];
|
|
3584
|
-
|
|
3585
3607
|
if (! bodyNode ._enabled .getValue ())
|
|
3586
3608
|
continue;
|
|
3587
3609
|
|
|
3588
3610
|
this .rigidBodies .push (bodyNode .getRigidBody ());
|
|
3589
3611
|
}
|
|
3590
3612
|
|
|
3591
|
-
for (
|
|
3592
|
-
this .dynamicsWorld .addRigidBody (
|
|
3613
|
+
for (const rigidBody of this .rigidBodies)
|
|
3614
|
+
this .dynamicsWorld .addRigidBody (rigidBody);
|
|
3593
3615
|
},
|
|
3594
3616
|
set_joints__ ()
|
|
3595
3617
|
{
|
|
3596
|
-
for (
|
|
3597
|
-
|
|
3618
|
+
for (const jointNode of this .jointNodes)
|
|
3619
|
+
jointNode .setCollection (null);
|
|
3598
3620
|
|
|
3599
3621
|
this .jointNodes .length = 0;
|
|
3600
3622
|
|
|
3601
|
-
for (
|
|
3602
|
-
|
|
3623
|
+
for (const otherJointNode of this .otherJointNodes)
|
|
3624
|
+
otherJointNode ._collection .removeInterest ("set_joints__", this);
|
|
3603
3625
|
|
|
3604
3626
|
this .otherJointNodes .length = 0;
|
|
3605
3627
|
|
|
3606
|
-
for (
|
|
3628
|
+
for (const node of this ._joints)
|
|
3607
3629
|
{
|
|
3608
|
-
|
|
3630
|
+
const jointNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DRigidJointNode, node);
|
|
3609
3631
|
|
|
3610
3632
|
if (! jointNode)
|
|
3611
3633
|
continue;
|
|
@@ -3626,8 +3648,7 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3626
3648
|
{
|
|
3627
3649
|
try
|
|
3628
3650
|
{
|
|
3629
|
-
|
|
3630
|
-
deltaTime = this .getTimeStep (),
|
|
3651
|
+
const
|
|
3631
3652
|
iterations = this ._iterations .getValue (),
|
|
3632
3653
|
gravity = this ._gravity .getValue ();
|
|
3633
3654
|
|
|
@@ -3636,26 +3657,28 @@ Object .assign (Object .setPrototypeOf (RigidBodyCollection .prototype, (externa
|
|
|
3636
3657
|
|
|
3637
3658
|
if (this ._preferAccuracy .getValue ())
|
|
3638
3659
|
{
|
|
3639
|
-
deltaTime
|
|
3660
|
+
const deltaTime = this .getTimeStep () / iterations;
|
|
3640
3661
|
|
|
3641
|
-
for (
|
|
3662
|
+
for (let i = 0; i < iterations; ++ i)
|
|
3642
3663
|
{
|
|
3643
|
-
for (
|
|
3644
|
-
|
|
3664
|
+
for (const bodyNode of this .bodyNodes)
|
|
3665
|
+
bodyNode .applyForces (gravity);
|
|
3645
3666
|
|
|
3646
3667
|
this .dynamicsWorld .stepSimulation (deltaTime, 0);
|
|
3647
3668
|
}
|
|
3648
3669
|
}
|
|
3649
3670
|
else
|
|
3650
3671
|
{
|
|
3651
|
-
|
|
3652
|
-
|
|
3672
|
+
const deltaTime = this .getTimeStep ();
|
|
3673
|
+
|
|
3674
|
+
for (const bodyNode of this .bodyNodes)
|
|
3675
|
+
bodyNode .applyForces (gravity);
|
|
3653
3676
|
|
|
3654
3677
|
this .dynamicsWorld .stepSimulation (deltaTime, iterations + 2, deltaTime / iterations);
|
|
3655
3678
|
}
|
|
3656
3679
|
|
|
3657
|
-
for (
|
|
3658
|
-
|
|
3680
|
+
for (const bodyNode of this .bodyNodes)
|
|
3681
|
+
bodyNode .update ();
|
|
3659
3682
|
}
|
|
3660
3683
|
catch (error)
|
|
3661
3684
|
{
|
|
@@ -3804,7 +3827,7 @@ Object .assign (Object .setPrototypeOf (SingleAxisHingeJoint .prototype, RigidBo
|
|
|
3804
3827
|
},
|
|
3805
3828
|
addJoint: (() =>
|
|
3806
3829
|
{
|
|
3807
|
-
|
|
3830
|
+
const
|
|
3808
3831
|
localAxis1 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
3809
3832
|
localAxis2 = new (external_X_ITE_X3D_Vector3_default()) ();
|
|
3810
3833
|
|
|
@@ -3825,7 +3848,7 @@ Object .assign (Object .setPrototypeOf (SingleAxisHingeJoint .prototype, RigidBo
|
|
|
3825
3848
|
if (this .getBody2 () .getCollection () !== this .getCollection ())
|
|
3826
3849
|
return;
|
|
3827
3850
|
|
|
3828
|
-
|
|
3851
|
+
const
|
|
3829
3852
|
localAnchorPoint1 = this .localAnchorPoint1,
|
|
3830
3853
|
localAnchorPoint2 = this .localAnchorPoint2;
|
|
3831
3854
|
|
|
@@ -3864,10 +3887,8 @@ Object .assign (Object .setPrototypeOf (SingleAxisHingeJoint .prototype, RigidBo
|
|
|
3864
3887
|
{
|
|
3865
3888
|
this .outputs .clear ();
|
|
3866
3889
|
|
|
3867
|
-
for (
|
|
3890
|
+
for (const value of this ._forceOutput)
|
|
3868
3891
|
{
|
|
3869
|
-
var value = this ._forceOutput [i];
|
|
3870
|
-
|
|
3871
3892
|
if (value == "ALL")
|
|
3872
3893
|
{
|
|
3873
3894
|
this .outputs .add ("body1AnchorPoint");
|
|
@@ -3885,7 +3906,7 @@ Object .assign (Object .setPrototypeOf (SingleAxisHingeJoint .prototype, RigidBo
|
|
|
3885
3906
|
},
|
|
3886
3907
|
update1: (() =>
|
|
3887
3908
|
{
|
|
3888
|
-
|
|
3909
|
+
const localAnchorPoint1 = new (external_X_ITE_X3D_Vector3_default()) ();
|
|
3889
3910
|
|
|
3890
3911
|
return function ()
|
|
3891
3912
|
{
|
|
@@ -3895,7 +3916,7 @@ Object .assign (Object .setPrototypeOf (SingleAxisHingeJoint .prototype, RigidBo
|
|
|
3895
3916
|
})(),
|
|
3896
3917
|
update2: (() =>
|
|
3897
3918
|
{
|
|
3898
|
-
|
|
3919
|
+
const
|
|
3899
3920
|
localAnchorPoint2 = new (external_X_ITE_X3D_Vector3_default()) (),
|
|
3900
3921
|
difference = new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
3901
3922
|
rotation = new (external_X_ITE_X3D_Rotation4_default()) ();
|
|
@@ -3907,7 +3928,7 @@ Object .assign (Object .setPrototypeOf (SingleAxisHingeJoint .prototype, RigidBo
|
|
|
3907
3928
|
|
|
3908
3929
|
if (this .outputs .has ("angle"))
|
|
3909
3930
|
{
|
|
3910
|
-
|
|
3931
|
+
const lastAngle = this ._angle .getValue ();
|
|
3911
3932
|
|
|
3912
3933
|
difference .assign (this .getInitialInverseMatrix2 ()) .multRight (this .getBody2 () .getMatrix ());
|
|
3913
3934
|
difference .get (null, rotation);
|
|
@@ -4024,7 +4045,7 @@ function SliderJoint (executionContext)
|
|
|
4024
4045
|
this ._separationRate .setUnit ("speed");
|
|
4025
4046
|
|
|
4026
4047
|
// Private properties
|
|
4027
|
-
|
|
4048
|
+
|
|
4028
4049
|
this .joint = null;
|
|
4029
4050
|
this .outputs = new Set ();
|
|
4030
4051
|
}
|
|
@@ -4041,7 +4062,7 @@ Object .assign (Object .setPrototypeOf (SliderJoint .prototype, RigidBodyPhysics
|
|
|
4041
4062
|
},
|
|
4042
4063
|
addJoint: (() =>
|
|
4043
4064
|
{
|
|
4044
|
-
|
|
4065
|
+
const
|
|
4045
4066
|
axisRotation = new (external_X_ITE_X3D_Rotation4_default()) (),
|
|
4046
4067
|
matrixA = new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
4047
4068
|
matrixB = new (external_X_ITE_X3D_Matrix4_default()) (),
|
|
@@ -4115,10 +4136,8 @@ Object .assign (Object .setPrototypeOf (SliderJoint .prototype, RigidBodyPhysics
|
|
|
4115
4136
|
{
|
|
4116
4137
|
this .outputs .clear ();
|
|
4117
4138
|
|
|
4118
|
-
for (
|
|
4139
|
+
for (const value of this ._forceOutput)
|
|
4119
4140
|
{
|
|
4120
|
-
var value = this ._forceOutput [i];
|
|
4121
|
-
|
|
4122
4141
|
if (value == "ALL")
|
|
4123
4142
|
{
|
|
4124
4143
|
this .outputs .add ("separation");
|