@zaisma/physics 2.6.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/rapier/rapier.js CHANGED
@@ -1,4 +1,4 @@
1
- // Rapier 0.19.3 (https://rapier.rs), the physics engine @zaisma/physics runs on, as Zaisma builds it (0.19.3-zaisma.2): Rapier's
1
+ // Rapier 0.19.3 (https://rapier.rs), the physics engine @zaisma/physics runs on, as Zaisma builds it (0.19.3-zaisma.3): Rapier's
2
2
  // JavaScript bindings at https://github.com/dimforge/rapier.js v0.19.3, with Zaisma's batch calls added and nothing of Rapier's
3
3
  // taken out, written as one module by Zaisma's engine build. Apache-2.0 licensed: LICENSE.txt beside this file; what
4
4
  // Zaisma changed is listed in CHANGES.md beside it. Not edited by hand. startEngine and startEngineLater at
@@ -657,8 +657,8 @@ var RawBatch = class {
657
657
  wasm.rawbatch_setSpeed(this.__wbg_ptr, bodies.__wbg_ptr, body, x, y, z, is_woken);
658
658
  }
659
659
  /**
660
- * The first thing a ball (shape_kind 0) or a capsule standing along its own y (shape_kind 1) meets moving along
661
- * a direction. Answers whether it met anything; then the floats hold how far (1), the point it touched (3) and
660
+ * The first thing a ball (shape_kind 0: radius_m), a capsule standing along its own y (1: radius_m and
661
+ * half_segment_m) or a box (2: half its width, height and depth, in that order) meets moving along a direction. Answers whether it met anything; then the floats hold how far (1), the point it touched (3) and
662
662
  * the surface's normal there (3), and the whole numbers its owner's tag, which of a mesh's triangles the point
663
663
  * is on (or 4294967295) and which collider it is.
664
664
  * @param {RawBroadPhase} broad_phase
@@ -668,6 +668,7 @@ var RawBatch = class {
668
668
  * @param {number} shape_kind
669
669
  * @param {number} radius_m
670
670
  * @param {number} half_segment_m
671
+ * @param {number} half_depth_m
671
672
  * @param {number} rotation_x
672
673
  * @param {number} rotation_y
673
674
  * @param {number} rotation_z
@@ -685,12 +686,12 @@ var RawBatch = class {
685
686
  * @param {number} query_flags
686
687
  * @returns {boolean}
687
688
  */
688
- castShape(broad_phase, narrow_phase, bodies, colliders, shape_kind, radius_m, half_segment_m, rotation_x, rotation_y, rotation_z, rotation_w, from_x, from_y, from_z, direction_x, direction_y, direction_z, maximum_distance_m, is_stopped_at_penetration, groups, excluded_body, query_flags) {
689
+ castShape(broad_phase, narrow_phase, bodies, colliders, shape_kind, radius_m, half_segment_m, half_depth_m, rotation_x, rotation_y, rotation_z, rotation_w, from_x, from_y, from_z, direction_x, direction_y, direction_z, maximum_distance_m, is_stopped_at_penetration, groups, excluded_body, query_flags) {
689
690
  _assertClass(broad_phase, RawBroadPhase);
690
691
  _assertClass(narrow_phase, RawNarrowPhase);
691
692
  _assertClass(bodies, RawRigidBodySet);
692
693
  _assertClass(colliders, RawColliderSet);
693
- const ret = wasm.rawbatch_castShape(this.__wbg_ptr, broad_phase.__wbg_ptr, narrow_phase.__wbg_ptr, bodies.__wbg_ptr, colliders.__wbg_ptr, shape_kind, radius_m, half_segment_m, rotation_x, rotation_y, rotation_z, rotation_w, from_x, from_y, from_z, direction_x, direction_y, direction_z, maximum_distance_m, is_stopped_at_penetration, groups, excluded_body, query_flags);
694
+ const ret = wasm.rawbatch_castShape(this.__wbg_ptr, broad_phase.__wbg_ptr, narrow_phase.__wbg_ptr, bodies.__wbg_ptr, colliders.__wbg_ptr, shape_kind, radius_m, half_segment_m, half_depth_m, rotation_x, rotation_y, rotation_z, rotation_w, from_x, from_y, from_z, direction_x, direction_y, direction_z, maximum_distance_m, is_stopped_at_penetration, groups, excluded_body, query_flags);
694
695
  return ret !== 0;
695
696
  }
696
697
  /**
@@ -761,6 +762,297 @@ var RawBatch = class {
761
762
  static restartMostHeldByteCount() {
762
763
  wasm.rawbatch_restartMostHeldByteCount();
763
764
  }
765
+ /**
766
+ * Everything a ray passes through, nearest first, one hit a shape. Answers how many, up to maximum_hit_count:
767
+ * each is four floats (how far, and the surface's normal there) and three whole numbers (its owner's tag, which
768
+ * of its triangles or 4294967295, and which collider).
769
+ * @param {RawBroadPhase} broad_phase
770
+ * @param {RawNarrowPhase} narrow_phase
771
+ * @param {RawRigidBodySet} bodies
772
+ * @param {RawColliderSet} colliders
773
+ * @param {number} from_x
774
+ * @param {number} from_y
775
+ * @param {number} from_z
776
+ * @param {number} direction_x
777
+ * @param {number} direction_y
778
+ * @param {number} direction_z
779
+ * @param {number} maximum_distance_m
780
+ * @param {number} groups
781
+ * @param {number} excluded_body
782
+ * @param {number} query_flags
783
+ * @param {number} maximum_hit_count
784
+ * @returns {number}
785
+ */
786
+ castRayAll(broad_phase, narrow_phase, bodies, colliders, from_x, from_y, from_z, direction_x, direction_y, direction_z, maximum_distance_m, groups, excluded_body, query_flags, maximum_hit_count) {
787
+ _assertClass(broad_phase, RawBroadPhase);
788
+ _assertClass(narrow_phase, RawNarrowPhase);
789
+ _assertClass(bodies, RawRigidBodySet);
790
+ _assertClass(colliders, RawColliderSet);
791
+ const ret = wasm.rawbatch_castRayAll(this.__wbg_ptr, broad_phase.__wbg_ptr, narrow_phase.__wbg_ptr, bodies.__wbg_ptr, colliders.__wbg_ptr, from_x, from_y, from_z, direction_x, direction_y, direction_z, maximum_distance_m, groups, excluded_body, query_flags, maximum_hit_count);
792
+ return ret >>> 0;
793
+ }
794
+ /**
795
+ * The zones' pull and push on the moving bodies stepZones found in them, as forces the engine works with through
796
+ * the whole step (so a zone with no gravity cancels the engine's own exactly, and nothing drifts): run once
797
+ * before the step's substeps, and ended by endZoneForces after them.
798
+ * @param {RawRigidBodySet} bodies
799
+ * @param {number} gravity_x
800
+ * @param {number} gravity_y
801
+ * @param {number} gravity_z
802
+ */
803
+ forceZones(bodies, gravity_x, gravity_y, gravity_z) {
804
+ _assertClass(bodies, RawRigidBodySet);
805
+ wasm.rawbatch_forceZones(this.__wbg_ptr, bodies.__wbg_ptr, gravity_x, gravity_y, gravity_z);
806
+ }
807
+ /**
808
+ * Has a zone ride a body: it goes where the body goes, and never counts that body.
809
+ * @param {number} zone
810
+ * @param {number} body
811
+ */
812
+ setZoneBody(zone, body) {
813
+ wasm.rawbatch_setZoneBody(this.__wbg_ptr, zone, body);
814
+ }
815
+ /**
816
+ * One more shape of a zone, placed in the zone's own space.
817
+ * @param {number} zone
818
+ * @param {number} shape_kind
819
+ * @param {number} first_m
820
+ * @param {number} second_m
821
+ * @param {number} third_m
822
+ * @param {number} x
823
+ * @param {number} y
824
+ * @param {number} z
825
+ * @param {number} rotation_x
826
+ * @param {number} rotation_y
827
+ * @param {number} rotation_z
828
+ * @param {number} rotation_w
829
+ */
830
+ addZoneShape(zone, shape_kind, first_m, second_m, third_m, x, y, z, rotation_x, rotation_y, rotation_z, rotation_w) {
831
+ wasm.rawbatch_addZoneShape(this.__wbg_ptr, zone, shape_kind, first_m, second_m, third_m, x, y, z, rotation_x, rotation_y, rotation_z, rotation_w);
832
+ }
833
+ /**
834
+ * How hard a joint pulled or pushed its two ends in the engine's last step: the impulse along the directions it
835
+ * locks, with what its limits (a rope gone taut, a slider at its stop) and its motor or spring gave, in newton
836
+ * seconds over one of the solver's own small steps. 0 for a joint that isn't there.
837
+ * @param {RawImpulseJointSet} joints
838
+ * @param {number} joint
839
+ * @returns {number}
840
+ */
841
+ static jointImpulse(joints, joint) {
842
+ _assertClass(joints, RawImpulseJointSet);
843
+ const ret = wasm.rawbatch_jointImpulse(joints.__wbg_ptr, joint);
844
+ return ret;
845
+ }
846
+ /**
847
+ * Everything a ball, a capsule, a box or a cylinder overlaps (QueryShapes says what the lengths are): answers
848
+ * how many, their owners' tags in the whole numbers (one owner may be there more than once, for each of its
849
+ * shapes).
850
+ * @param {RawBroadPhase} broad_phase
851
+ * @param {RawNarrowPhase} narrow_phase
852
+ * @param {RawRigidBodySet} bodies
853
+ * @param {RawColliderSet} colliders
854
+ * @param {number} shape_kind
855
+ * @param {number} first_m
856
+ * @param {number} second_m
857
+ * @param {number} third_m
858
+ * @param {number} center_x
859
+ * @param {number} center_y
860
+ * @param {number} center_z
861
+ * @param {number} rotation_x
862
+ * @param {number} rotation_y
863
+ * @param {number} rotation_z
864
+ * @param {number} rotation_w
865
+ * @param {number} groups
866
+ * @param {number} excluded_body
867
+ * @param {number} query_flags
868
+ * @returns {number}
869
+ */
870
+ overlapShape(broad_phase, narrow_phase, bodies, colliders, shape_kind, first_m, second_m, third_m, center_x, center_y, center_z, rotation_x, rotation_y, rotation_z, rotation_w, groups, excluded_body, query_flags) {
871
+ _assertClass(broad_phase, RawBroadPhase);
872
+ _assertClass(narrow_phase, RawNarrowPhase);
873
+ _assertClass(bodies, RawRigidBodySet);
874
+ _assertClass(colliders, RawColliderSet);
875
+ const ret = wasm.rawbatch_overlapShape(this.__wbg_ptr, broad_phase.__wbg_ptr, narrow_phase.__wbg_ptr, bodies.__wbg_ptr, colliders.__wbg_ptr, shape_kind, first_m, second_m, third_m, center_x, center_y, center_z, rotation_x, rotation_y, rotation_z, rotation_w, groups, excluded_body, query_flags);
876
+ return ret >>> 0;
877
+ }
878
+ /**
879
+ * The zones that are on and that a ball, a capsule, a box or a cylinder at a place touches now: answers how
880
+ * many, their numbers in the whole numbers.
881
+ * @param {RawNarrowPhase} narrow_phase
882
+ * @param {RawRigidBodySet} bodies
883
+ * @param {number} shape_kind
884
+ * @param {number} first_m
885
+ * @param {number} second_m
886
+ * @param {number} third_m
887
+ * @param {number} center_x
888
+ * @param {number} center_y
889
+ * @param {number} center_z
890
+ * @param {number} rotation_x
891
+ * @param {number} rotation_y
892
+ * @param {number} rotation_z
893
+ * @param {number} rotation_w
894
+ * @returns {number}
895
+ */
896
+ zonesOfShape(narrow_phase, bodies, shape_kind, first_m, second_m, third_m, center_x, center_y, center_z, rotation_x, rotation_y, rotation_z, rotation_w) {
897
+ _assertClass(narrow_phase, RawNarrowPhase);
898
+ _assertClass(bodies, RawRigidBodySet);
899
+ const ret = wasm.rawbatch_zonesOfShape(this.__wbg_ptr, narrow_phase.__wbg_ptr, bodies.__wbg_ptr, shape_kind, first_m, second_m, third_m, center_x, center_y, center_z, rotation_x, rotation_y, rotation_z, rotation_w);
900
+ return ret >>> 0;
901
+ }
902
+ /**
903
+ * Ends the forces forceZones left on the bodies in the zones: the step's substeps are done.
904
+ * @param {RawRigidBodySet} bodies
905
+ */
906
+ endZoneForces(bodies) {
907
+ _assertClass(bodies, RawRigidBodySet);
908
+ wasm.rawbatch_endZoneForces(this.__wbg_ptr, bodies.__wbg_ptr);
909
+ }
910
+ /**
911
+ * @param {number} zone
912
+ * @returns {boolean}
913
+ */
914
+ isZoneEnabled(zone) {
915
+ const ret = wasm.rawbatch_isZoneEnabled(this.__wbg_ptr, zone);
916
+ return ret !== 0;
917
+ }
918
+ /**
919
+ * Who was in a zone at the last stepZones: answers how many, their tags in the whole numbers.
920
+ * @param {number} zone
921
+ * @returns {number}
922
+ */
923
+ zoneOccupants(zone) {
924
+ const ret = wasm.rawbatch_zoneOccupants(this.__wbg_ptr, zone);
925
+ return ret >>> 0;
926
+ }
927
+ /**
928
+ * Switches a zone on or off: off, nobody is in it and it does nothing.
929
+ * @param {number} zone
930
+ * @param {boolean} is_enabled
931
+ */
932
+ setZoneEnabled(zone, is_enabled) {
933
+ wasm.rawbatch_setZoneEnabled(this.__wbg_ptr, zone, is_enabled);
934
+ }
935
+ /**
936
+ * Ends every force and turn forceBody left on a body.
937
+ * @param {RawRigidBodySet} bodies
938
+ * @param {number} body
939
+ */
940
+ static resetBodyForces(bodies, body) {
941
+ _assertClass(bodies, RawRigidBodySet);
942
+ wasm.rawbatch_resetBodyForces(bodies.__wbg_ptr, body);
943
+ }
944
+ /**
945
+ * Forgets that a body or a character was in any zone (it left the world): whoever takes its number next comes
946
+ * in afresh.
947
+ * @param {number} tag
948
+ */
949
+ forgetZoneOccupant(tag) {
950
+ wasm.rawbatch_forgetZoneOccupant(this.__wbg_ptr, tag);
951
+ }
952
+ /**
953
+ * The most a joint's motor pushes: newtons along a slider, newton metres about a hinge.
954
+ * @param {RawImpulseJointSet} joints
955
+ * @param {number} joint
956
+ * @param {boolean} is_turning
957
+ * @param {number} maximum_force
958
+ */
959
+ static setMotorMaximumForce(joints, joint, is_turning, maximum_force) {
960
+ _assertClass(joints, RawImpulseJointSet);
961
+ wasm.rawbatch_setMotorMaximumForce(joints.__wbg_ptr, joint, is_turning, maximum_force);
962
+ }
963
+ /**
964
+ * Adds a zone at a place (in the world, or in its body's own space once setZoneBody names one), counting who's
965
+ * on the layers its groups search. Answers its number. gravity_scale is how much of gravity pulls there (1: all
966
+ * of it), push what speeds things up there each second, drag how quickly their speed and spin die away.
967
+ * @param {number} x
968
+ * @param {number} y
969
+ * @param {number} z
970
+ * @param {number} rotation_x
971
+ * @param {number} rotation_y
972
+ * @param {number} rotation_z
973
+ * @param {number} rotation_w
974
+ * @param {number} groups
975
+ * @param {number} gravity_scale
976
+ * @param {number} push_x
977
+ * @param {number} push_y
978
+ * @param {number} push_z
979
+ * @param {number} drag
980
+ * @returns {number}
981
+ */
982
+ addZone(x, y, z, rotation_x, rotation_y, rotation_z, rotation_w, groups, gravity_scale, push_x, push_y, push_z, drag) {
983
+ const ret = wasm.rawbatch_addZone(this.__wbg_ptr, x, y, z, rotation_x, rotation_y, rotation_z, rotation_w, groups, gravity_scale, push_x, push_y, push_z, drag);
984
+ return ret >>> 0;
985
+ }
986
+ /**
987
+ * Many rays in one call. The floats hold each ray's start and direction (6 floats a ray, a direction of any
988
+ * length); the first thing each meets is written after them, four floats a ray (how far, or -1 for nothing, and
989
+ * the surface's normal there), with three whole numbers a ray (its owner's tag, its triangle or 4294967295, its
990
+ * collider). Answers how many met something.
991
+ * @param {RawBroadPhase} broad_phase
992
+ * @param {RawNarrowPhase} narrow_phase
993
+ * @param {RawRigidBodySet} bodies
994
+ * @param {RawColliderSet} colliders
995
+ * @param {number} ray_count
996
+ * @param {number} maximum_distance_m
997
+ * @param {number} groups
998
+ * @param {number} excluded_body
999
+ * @param {number} query_flags
1000
+ * @returns {number}
1001
+ */
1002
+ castRays(broad_phase, narrow_phase, bodies, colliders, ray_count, maximum_distance_m, groups, excluded_body, query_flags) {
1003
+ _assertClass(broad_phase, RawBroadPhase);
1004
+ _assertClass(narrow_phase, RawNarrowPhase);
1005
+ _assertClass(bodies, RawRigidBodySet);
1006
+ _assertClass(colliders, RawColliderSet);
1007
+ const ret = wasm.rawbatch_castRays(this.__wbg_ptr, broad_phase.__wbg_ptr, narrow_phase.__wbg_ptr, bodies.__wbg_ptr, colliders.__wbg_ptr, ray_count, maximum_distance_m, groups, excluded_body, query_flags);
1008
+ return ret >>> 0;
1009
+ }
1010
+ /**
1011
+ * Pushes a moving body. mode's bits: 1 at a place in the world (else at its centre of mass), 2 at once as a
1012
+ * change of speed (newton seconds; else a force in newtons that lasts until resetBodyForces), 4 a turn about
1013
+ * the axes (newton metres) instead of a push along them.
1014
+ * @param {RawRigidBodySet} bodies
1015
+ * @param {number} body
1016
+ * @param {number} x
1017
+ * @param {number} y
1018
+ * @param {number} z
1019
+ * @param {number} at_x
1020
+ * @param {number} at_y
1021
+ * @param {number} at_z
1022
+ * @param {number} mode
1023
+ */
1024
+ static forceBody(bodies, body, x, y, z, at_x, at_y, at_z, mode) {
1025
+ _assertClass(bodies, RawRigidBodySet);
1026
+ wasm.rawbatch_forceBody(bodies.__wbg_ptr, body, x, y, z, at_x, at_y, at_z, mode);
1027
+ }
1028
+ /**
1029
+ * The zones' drag on the moving bodies in them, for one of the step's substeps: run before each.
1030
+ * @param {RawRigidBodySet} bodies
1031
+ * @param {number} substep_duration_sec
1032
+ */
1033
+ slowZones(bodies, substep_duration_sec) {
1034
+ _assertClass(bodies, RawRigidBodySet);
1035
+ wasm.rawbatch_slowZones(this.__wbg_ptr, bodies.__wbg_ptr, substep_duration_sec);
1036
+ }
1037
+ /**
1038
+ * Before a step: finds who's in each zone now, and pulls, pushes and slows the moving bodies in one that does
1039
+ * (a body at rest in one is left at rest; one that has just come in is woken). Answers how many came in or left
1040
+ * since the last call: each is two whole numbers, the zone's number (with the top bit set for one that came in)
1041
+ * and the tag of who. When they don't all fit, the zones left over say theirs at the next call.
1042
+ * @param {RawBroadPhase} broad_phase
1043
+ * @param {RawNarrowPhase} narrow_phase
1044
+ * @param {RawRigidBodySet} bodies
1045
+ * @param {RawColliderSet} colliders
1046
+ * @returns {number}
1047
+ */
1048
+ stepZones(broad_phase, narrow_phase, bodies, colliders) {
1049
+ _assertClass(broad_phase, RawBroadPhase);
1050
+ _assertClass(narrow_phase, RawNarrowPhase);
1051
+ _assertClass(bodies, RawRigidBodySet);
1052
+ _assertClass(colliders, RawColliderSet);
1053
+ const ret = wasm.rawbatch_stepZones(this.__wbg_ptr, broad_phase.__wbg_ptr, narrow_phase.__wbg_ptr, bodies.__wbg_ptr, colliders.__wbg_ptr);
1054
+ return ret >>> 0;
1055
+ }
764
1056
  };
765
1057
  var RawBroadPhaseFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
766
1058
  }, unregister: () => {
@@ -14409,7 +14701,7 @@ function reserveMemory(extraBytesCount) {
14409
14701
  }
14410
14702
 
14411
14703
  // ../../../../.cache/zaisma/physics-engine/package/engine-entry.js
14412
- var ENGINE_VERSION = "0.19.3-zaisma.2";
14704
+ var ENGINE_VERSION = "0.19.3-zaisma.3";
14413
14705
  var importObject = () => ({ "./rapier_wasm3d_bg.js": rapier_wasm3d_bg_exports });
14414
14706
  var engineExports = null;
14415
14707
  function started(exports) {
Binary file