@galacean/engine-physics-lite 1.4.0-alpha.0 → 1.4.0-alpha.1
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/browser.js +101 -40
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +101 -40
- package/dist/main.js.map +1 -1
- package/dist/module.js +101 -40
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/LiteDynamicCollider.d.ts +36 -0
- package/types/LitePhysicsScene.d.ts +0 -9
package/dist/browser.js
CHANGED
|
@@ -486,11 +486,13 @@
|
|
|
486
486
|
*/ _proto.addShape = function addShape(shape) {
|
|
487
487
|
var oldCollider = shape._collider;
|
|
488
488
|
if (oldCollider !== this) {
|
|
489
|
+
var _this__scene;
|
|
489
490
|
if (oldCollider) {
|
|
490
491
|
oldCollider.removeShape(shape);
|
|
491
492
|
}
|
|
492
493
|
this._shapes.push(shape);
|
|
493
494
|
shape._collider = this;
|
|
495
|
+
(_this__scene = this._scene) == null ? void 0 : _this__scene._addColliderShape(shape);
|
|
494
496
|
}
|
|
495
497
|
};
|
|
496
498
|
/**
|
|
@@ -498,8 +500,10 @@
|
|
|
498
500
|
*/ _proto.removeShape = function removeShape(shape) {
|
|
499
501
|
var index = this._shapes.indexOf(shape);
|
|
500
502
|
if (index !== -1) {
|
|
503
|
+
var _this__scene;
|
|
501
504
|
this._shapes.splice(index, 1);
|
|
502
505
|
shape._collider = null;
|
|
506
|
+
(_this__scene = this._scene) == null ? void 0 : _this__scene._removeColliderShape(shape);
|
|
503
507
|
}
|
|
504
508
|
};
|
|
505
509
|
/**
|
|
@@ -545,6 +549,23 @@
|
|
|
545
549
|
}
|
|
546
550
|
var _proto = LiteDynamicCollider.prototype;
|
|
547
551
|
/**
|
|
552
|
+
* {@inheritDoc IDynamicCollider.getInertiaTensor }
|
|
553
|
+
*/ _proto.getInertiaTensor = function getInertiaTensor(out) {
|
|
554
|
+
console.error("Physics-lite don't support getInertiaTensor. Use Physics-PhysX instead!");
|
|
555
|
+
return out;
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* {@inheritDoc IDynamicCollider.getCenterOfMass }
|
|
559
|
+
*/ _proto.getCenterOfMass = function getCenterOfMass(out) {
|
|
560
|
+
console.error("Physics-lite don't support getCenterOfMass. Use Physics-PhysX instead!");
|
|
561
|
+
return out;
|
|
562
|
+
};
|
|
563
|
+
/**
|
|
564
|
+
* {@inheritDoc IDynamicCollider.setMassAndUpdateInertia }
|
|
565
|
+
*/ _proto.setMassAndUpdateInertia = function setMassAndUpdateInertia(mass) {
|
|
566
|
+
console.error("Physics-lite don't support setMassAndUpdateInertia. Use Physics-PhysX instead!");
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
548
569
|
* {@inheritDoc IDynamicCollider.addForce }
|
|
549
570
|
*/ _proto.addForce = function addForce(force) {
|
|
550
571
|
throw "Physics-lite don't support addForce. Use Physics-PhysX instead!";
|
|
@@ -565,74 +586,106 @@
|
|
|
565
586
|
throw "Physics-lite don't support putToSleep. Use Physics-PhysX instead!";
|
|
566
587
|
};
|
|
567
588
|
/**
|
|
589
|
+
* {@inheritDoc IDynamicCollider.isSleeping }
|
|
590
|
+
*/ _proto.isSleeping = function isSleeping() {
|
|
591
|
+
throw "Physics-lite don't support isSleeping. Use Physics-PhysX instead!";
|
|
592
|
+
};
|
|
593
|
+
/**
|
|
594
|
+
* {@inheritDoc IDynamicCollider.getAngularDamping }
|
|
595
|
+
*/ _proto.getAngularDamping = function getAngularDamping() {
|
|
596
|
+
throw "Physics-lite don't support getAngularDamping. Use Physics-PhysX instead!";
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
568
599
|
* {@inheritDoc IDynamicCollider.setAngularDamping }
|
|
569
600
|
*/ _proto.setAngularDamping = function setAngularDamping(value) {
|
|
570
|
-
|
|
601
|
+
console.error("Physics-lite don't support setAngularDamping. Use Physics-PhysX instead!");
|
|
602
|
+
};
|
|
603
|
+
/**
|
|
604
|
+
* {@inheritDoc IDynamicCollider.getAngularVelocity }
|
|
605
|
+
*/ _proto.getAngularVelocity = function getAngularVelocity(out) {
|
|
606
|
+
console.error("Physics-lite don't support getAngularVelocity. Use Physics-PhysX instead!");
|
|
607
|
+
return out;
|
|
571
608
|
};
|
|
572
609
|
/**
|
|
573
610
|
* {@inheritDoc IDynamicCollider.setAngularVelocity }
|
|
574
611
|
*/ _proto.setAngularVelocity = function setAngularVelocity(value) {
|
|
575
|
-
|
|
612
|
+
console.error("Physics-lite don't support setAngularVelocity. Use Physics-PhysX instead!");
|
|
576
613
|
};
|
|
577
614
|
/**
|
|
578
615
|
* {@inheritDoc IDynamicCollider.setCenterOfMass }
|
|
579
616
|
*/ _proto.setCenterOfMass = function setCenterOfMass(value) {
|
|
580
|
-
|
|
617
|
+
console.error("Physics-lite don't support setCenterOfMass. Use Physics-PhysX instead!");
|
|
581
618
|
};
|
|
582
619
|
/**
|
|
583
620
|
* {@inheritDoc IDynamicCollider.setCollisionDetectionMode }
|
|
584
621
|
*/ _proto.setCollisionDetectionMode = function setCollisionDetectionMode(value) {
|
|
585
|
-
|
|
622
|
+
console.error("Physics-lite don't support setCollisionDetectionMode. Use Physics-PhysX instead!");
|
|
586
623
|
};
|
|
587
624
|
/**
|
|
588
625
|
* {@inheritDoc IDynamicCollider.setConstraints }
|
|
589
626
|
*/ _proto.setConstraints = function setConstraints(flags) {
|
|
590
|
-
|
|
627
|
+
console.error("Physics-lite don't support setConstraints. Use Physics-PhysX instead!");
|
|
591
628
|
};
|
|
592
629
|
/**
|
|
593
630
|
* {@inheritDoc IDynamicCollider.setInertiaTensor }
|
|
594
631
|
*/ _proto.setInertiaTensor = function setInertiaTensor(value) {
|
|
595
|
-
|
|
632
|
+
console.error("Physics-lite don't support setInertiaTensor. Use Physics-PhysX instead!");
|
|
596
633
|
};
|
|
597
634
|
/**
|
|
598
635
|
* {@inheritDoc IDynamicCollider.setIsKinematic }
|
|
599
636
|
*/ _proto.setIsKinematic = function setIsKinematic(value) {
|
|
600
|
-
|
|
637
|
+
console.error("Physics-lite don't support setIsKinematic. Use Physics-PhysX instead!");
|
|
638
|
+
};
|
|
639
|
+
/**
|
|
640
|
+
* {@inheritDoc IDynamicCollider.setLinearDamping }
|
|
641
|
+
*/ _proto.getLinearDamping = function getLinearDamping() {
|
|
642
|
+
throw "Physics-lite don't support getLinearDamping. Use Physics-PhysX instead!";
|
|
601
643
|
};
|
|
602
644
|
/**
|
|
603
645
|
* {@inheritDoc IDynamicCollider.setLinearDamping }
|
|
604
646
|
*/ _proto.setLinearDamping = function setLinearDamping(value) {
|
|
605
|
-
|
|
647
|
+
console.error("Physics-lite don't support setLinearDamping. Use Physics-PhysX instead!");
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* {@inheritDoc IDynamicCollider.getLinearVelocity }
|
|
651
|
+
*/ _proto.getLinearVelocity = function getLinearVelocity(out) {
|
|
652
|
+
console.error("Physics-lite don't support getLinearVelocity. Use Physics-PhysX instead!");
|
|
653
|
+
return out;
|
|
606
654
|
};
|
|
607
655
|
/**
|
|
608
656
|
* {@inheritDoc IDynamicCollider.setLinearVelocity }
|
|
609
657
|
*/ _proto.setLinearVelocity = function setLinearVelocity(value) {
|
|
610
|
-
|
|
658
|
+
console.error("Physics-lite don't support setLinearVelocity. Use Physics-PhysX instead!");
|
|
611
659
|
};
|
|
612
660
|
/**
|
|
613
661
|
* {@inheritDoc IDynamicCollider.setMass }
|
|
614
662
|
*/ _proto.setMass = function setMass(value) {
|
|
615
|
-
|
|
663
|
+
console.error("Physics-lite don't support setMass. Use Physics-PhysX instead!");
|
|
616
664
|
};
|
|
617
665
|
/**
|
|
618
666
|
* {@inheritDoc IDynamicCollider.setMaxAngularVelocity }
|
|
619
667
|
*/ _proto.setMaxAngularVelocity = function setMaxAngularVelocity(value) {
|
|
620
|
-
|
|
668
|
+
console.error("Physics-lite don't support setMaxAngularVelocity. Use Physics-PhysX instead!");
|
|
669
|
+
};
|
|
670
|
+
/**
|
|
671
|
+
* {@inheritDoc IDynamicCollider.setMaxDepenetrationVelocity }
|
|
672
|
+
*/ _proto.getMaxDepenetrationVelocity = function getMaxDepenetrationVelocity() {
|
|
673
|
+
throw "Physics-lite don't support getMaxDepenetrationVelocity. Use Physics-PhysX instead!";
|
|
621
674
|
};
|
|
622
675
|
/**
|
|
623
676
|
* {@inheritDoc IDynamicCollider.setMaxDepenetrationVelocity }
|
|
624
677
|
*/ _proto.setMaxDepenetrationVelocity = function setMaxDepenetrationVelocity(value) {
|
|
625
|
-
|
|
678
|
+
console.error("Physics-lite don't support setMaxDepenetrationVelocity. Use Physics-PhysX instead!");
|
|
626
679
|
};
|
|
627
680
|
/**
|
|
628
681
|
* {@inheritDoc IDynamicCollider.setSleepThreshold }
|
|
629
682
|
*/ _proto.setSleepThreshold = function setSleepThreshold(value) {
|
|
630
|
-
|
|
683
|
+
console.error("Physics-lite don't support setSleepThreshold. Use Physics-PhysX instead!");
|
|
631
684
|
};
|
|
632
685
|
/**
|
|
633
686
|
* {@inheritDoc IDynamicCollider.setSolverIterations }
|
|
634
687
|
*/ _proto.setSolverIterations = function setSolverIterations(value) {
|
|
635
|
-
|
|
688
|
+
console.error("Physics-lite don't support setSolverIterations. Use Physics-PhysX instead!");
|
|
636
689
|
};
|
|
637
690
|
/**
|
|
638
691
|
* {@inheritDoc IDynamicCollider.wakeUp }
|
|
@@ -822,41 +875,26 @@
|
|
|
822
875
|
console.log("Physics-lite don't support gravity. Use Physics-PhysX instead!");
|
|
823
876
|
};
|
|
824
877
|
/**
|
|
825
|
-
* {@inheritDoc IPhysicsManager.addColliderShape }
|
|
826
|
-
*/ _proto.addColliderShape = function addColliderShape(colliderShape) {
|
|
827
|
-
this._eventMap[colliderShape._id] = {};
|
|
828
|
-
};
|
|
829
|
-
/**
|
|
830
|
-
* {@inheritDoc IPhysicsManager.removeColliderShape }
|
|
831
|
-
*/ _proto.removeColliderShape = function removeColliderShape(colliderShape) {
|
|
832
|
-
var _this = this, eventPool = _this._eventPool, currentEvents = _this._currentEvents, eventMap = _this._eventMap;
|
|
833
|
-
var id = colliderShape._id;
|
|
834
|
-
currentEvents.forEach(function(event, i) {
|
|
835
|
-
if (event.index1 == id) {
|
|
836
|
-
currentEvents.deleteByIndex(i);
|
|
837
|
-
eventPool.push(event);
|
|
838
|
-
} else if (event.index2 == id) {
|
|
839
|
-
currentEvents.deleteByIndex(i);
|
|
840
|
-
eventPool.push(event);
|
|
841
|
-
// If the shape is big index, should clear from the small index shape subMap
|
|
842
|
-
eventMap[event.index1][id] = undefined;
|
|
843
|
-
}
|
|
844
|
-
});
|
|
845
|
-
delete eventMap[id];
|
|
846
|
-
};
|
|
847
|
-
/**
|
|
848
878
|
* {@inheritDoc IPhysicsManager.addCollider }
|
|
849
879
|
*/ _proto.addCollider = function addCollider(actor) {
|
|
880
|
+
actor._scene = this;
|
|
850
881
|
var colliders = actor._isStaticCollider ? this._staticColliders : this._dynamicColliders;
|
|
851
882
|
colliders.push(actor);
|
|
883
|
+
var shapes = actor._shapes;
|
|
884
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
885
|
+
this._addColliderShape(shapes[i]);
|
|
886
|
+
}
|
|
852
887
|
};
|
|
853
888
|
/**
|
|
854
889
|
* {@inheritDoc IPhysicsManager.removeCollider }
|
|
855
890
|
*/ _proto.removeCollider = function removeCollider(collider) {
|
|
891
|
+
collider._scene = null;
|
|
856
892
|
var colliders = collider._isStaticCollider ? this._staticColliders : this._dynamicColliders;
|
|
857
893
|
var index = colliders.indexOf(collider);
|
|
858
|
-
|
|
859
|
-
|
|
894
|
+
index > -1 && colliders.splice(index, 1);
|
|
895
|
+
var shapes = collider._shapes;
|
|
896
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
897
|
+
this._removeColliderShape(shapes[i]);
|
|
860
898
|
}
|
|
861
899
|
};
|
|
862
900
|
/**
|
|
@@ -904,6 +942,29 @@
|
|
|
904
942
|
*/ _proto.removeCharacterController = function removeCharacterController(characterController) {
|
|
905
943
|
throw "Physics-lite don't support removeCharacterController. Use Physics-PhysX instead!";
|
|
906
944
|
};
|
|
945
|
+
/**
|
|
946
|
+
* @internal
|
|
947
|
+
*/ _proto._addColliderShape = function _addColliderShape(colliderShape) {
|
|
948
|
+
this._eventMap[colliderShape._id] = {};
|
|
949
|
+
};
|
|
950
|
+
/**
|
|
951
|
+
* @internal
|
|
952
|
+
*/ _proto._removeColliderShape = function _removeColliderShape(colliderShape) {
|
|
953
|
+
var _this = this, eventPool = _this._eventPool, currentEvents = _this._currentEvents, eventMap = _this._eventMap;
|
|
954
|
+
var id = colliderShape._id;
|
|
955
|
+
currentEvents.forEach(function(event, i) {
|
|
956
|
+
if (event.index1 == id) {
|
|
957
|
+
currentEvents.deleteByIndex(i);
|
|
958
|
+
eventPool.push(event);
|
|
959
|
+
} else if (event.index2 == id) {
|
|
960
|
+
currentEvents.deleteByIndex(i);
|
|
961
|
+
eventPool.push(event);
|
|
962
|
+
// If the shape is big index, should clear from the small index shape subMap
|
|
963
|
+
eventMap[event.index1][id] = undefined;
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
delete eventMap[id];
|
|
967
|
+
};
|
|
907
968
|
_proto._getTrigger = function _getTrigger(index1, index2) {
|
|
908
969
|
var event;
|
|
909
970
|
if (this._eventPool.length) {
|
|
@@ -1165,7 +1226,7 @@
|
|
|
1165
1226
|
}();
|
|
1166
1227
|
|
|
1167
1228
|
//@ts-ignore
|
|
1168
|
-
var version = "1.4.0-alpha.
|
|
1229
|
+
var version = "1.4.0-alpha.1";
|
|
1169
1230
|
console.log("Galacean PhysicsLite version: " + version);
|
|
1170
1231
|
|
|
1171
1232
|
exports.LitePhysics = LitePhysics;
|