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

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