@galacean/engine-physics-lite 1.3.3 → 1.3.4

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.
@@ -962,7 +962,10 @@ var /**
962
962
  return this._raycast(ray, distance, onRaycast, this._staticColliders, hit) || this._raycast(ray, distance, onRaycast, this._dynamicColliders, hit);
963
963
  } else {
964
964
  var raycastStaticRes = this._raycast(ray, distance, onRaycast, this._staticColliders, hit);
965
- var raycastDynamicRes = this._raycast(ray, LitePhysicsScene._currentHit.distance, onRaycast, this._dynamicColliders, hit);
965
+ if (raycastStaticRes) {
966
+ distance = LitePhysicsScene._currentHit.distance;
967
+ }
968
+ var raycastDynamicRes = this._raycast(ray, distance, onRaycast, this._dynamicColliders, hit);
966
969
  var isHit = raycastStaticRes || raycastDynamicRes;
967
970
  var hitResult = LitePhysicsScene._hitResult;
968
971
  if (!isHit) {
@@ -1105,26 +1108,19 @@ var /**
1105
1108
  return false;
1106
1109
  };
1107
1110
  _proto._raycast = function _raycast(ray, distance, onRaycast, colliders, hit) {
1108
- var hitResult;
1109
- if (hit) {
1110
- hitResult = LitePhysicsScene._hitResult;
1111
- }
1112
1111
  var isHit = false;
1113
1112
  var curHit = LitePhysicsScene._currentHit;
1114
1113
  for(var i = 0, len = colliders.length; i < len; i++){
1115
- var collider = colliders[i];
1116
- if (collider._raycast(ray, onRaycast, curHit)) {
1117
- isHit = true;
1118
- if (curHit.distance < distance) {
1119
- if (hitResult) {
1120
- hitResult.normal.copyFrom(curHit.normal);
1121
- hitResult.point.copyFrom(curHit.point);
1122
- hitResult.distance = curHit.distance;
1123
- hitResult.shapeID = curHit.shapeID;
1124
- } else {
1125
- return true;
1126
- }
1127
- distance = curHit.distance;
1114
+ if (colliders[i]._raycast(ray, onRaycast, curHit) && curHit.distance < distance) {
1115
+ if (hit) {
1116
+ isHit = true;
1117
+ var hitResult = LitePhysicsScene._hitResult;
1118
+ hitResult.normal.copyFrom(curHit.normal);
1119
+ hitResult.point.copyFrom(curHit.point);
1120
+ hitResult.distance = distance = curHit.distance;
1121
+ hitResult.shapeID = curHit.shapeID;
1122
+ } else {
1123
+ return true;
1128
1124
  }
1129
1125
  }
1130
1126
  }
@@ -1271,7 +1267,7 @@ var LitePhysics = /*#__PURE__*/ function() {
1271
1267
  }();
1272
1268
 
1273
1269
  //@ts-ignore
1274
- var version = "1.3.3";
1270
+ var version = "1.3.4";
1275
1271
  console.log("Galacean PhysicsLite version: " + version);
1276
1272
 
1277
1273
  exports.LitePhysics = LitePhysics;
package/dist/module.js CHANGED
@@ -958,7 +958,10 @@ var /**
958
958
  return this._raycast(ray, distance, onRaycast, this._staticColliders, hit) || this._raycast(ray, distance, onRaycast, this._dynamicColliders, hit);
959
959
  } else {
960
960
  var raycastStaticRes = this._raycast(ray, distance, onRaycast, this._staticColliders, hit);
961
- var raycastDynamicRes = this._raycast(ray, LitePhysicsScene._currentHit.distance, onRaycast, this._dynamicColliders, hit);
961
+ if (raycastStaticRes) {
962
+ distance = LitePhysicsScene._currentHit.distance;
963
+ }
964
+ var raycastDynamicRes = this._raycast(ray, distance, onRaycast, this._dynamicColliders, hit);
962
965
  var isHit = raycastStaticRes || raycastDynamicRes;
963
966
  var hitResult = LitePhysicsScene._hitResult;
964
967
  if (!isHit) {
@@ -1101,26 +1104,19 @@ var /**
1101
1104
  return false;
1102
1105
  };
1103
1106
  _proto._raycast = function _raycast(ray, distance, onRaycast, colliders, hit) {
1104
- var hitResult;
1105
- if (hit) {
1106
- hitResult = LitePhysicsScene._hitResult;
1107
- }
1108
1107
  var isHit = false;
1109
1108
  var curHit = LitePhysicsScene._currentHit;
1110
1109
  for(var i = 0, len = colliders.length; i < len; i++){
1111
- var collider = colliders[i];
1112
- if (collider._raycast(ray, onRaycast, curHit)) {
1113
- isHit = true;
1114
- if (curHit.distance < distance) {
1115
- if (hitResult) {
1116
- hitResult.normal.copyFrom(curHit.normal);
1117
- hitResult.point.copyFrom(curHit.point);
1118
- hitResult.distance = curHit.distance;
1119
- hitResult.shapeID = curHit.shapeID;
1120
- } else {
1121
- return true;
1122
- }
1123
- distance = curHit.distance;
1110
+ if (colliders[i]._raycast(ray, onRaycast, curHit) && curHit.distance < distance) {
1111
+ if (hit) {
1112
+ isHit = true;
1113
+ var hitResult = LitePhysicsScene._hitResult;
1114
+ hitResult.normal.copyFrom(curHit.normal);
1115
+ hitResult.point.copyFrom(curHit.point);
1116
+ hitResult.distance = distance = curHit.distance;
1117
+ hitResult.shapeID = curHit.shapeID;
1118
+ } else {
1119
+ return true;
1124
1120
  }
1125
1121
  }
1126
1122
  }
@@ -1267,7 +1263,7 @@ var LitePhysics = /*#__PURE__*/ function() {
1267
1263
  }();
1268
1264
 
1269
1265
  //@ts-ignore
1270
- var version = "1.3.3";
1266
+ var version = "1.3.4";
1271
1267
  console.log("Galacean PhysicsLite version: " + version);
1272
1268
 
1273
1269
  export { LitePhysics, version };