@galacean/engine-math 2.0.0-alpha.14 → 2.0.0-alpha.16

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/main.js CHANGED
@@ -985,11 +985,15 @@ BoundingBox._tempVec31 = new Vector3();
985
985
  var normal = plane.normal;
986
986
  var zeroTolerance = MathUtil.zeroTolerance;
987
987
  var dir = Vector3.dot(normal, ray.direction);
988
+ var position = Vector3.dot(normal, ray.origin);
988
989
  // Parallel
989
990
  if (Math.abs(dir) < zeroTolerance) {
991
+ // Check if ray origin is on the plane
992
+ if (Math.abs(position + plane.distance) < zeroTolerance) {
993
+ return 0;
994
+ }
990
995
  return -1;
991
996
  }
992
- var position = Vector3.dot(normal, ray.origin);
993
997
  var distance = (-plane.distance - position) / dir;
994
998
  if (distance < 0) {
995
999
  if (distance < -zeroTolerance) {