/// <summary> /// take into acount unidirectinnal option, return null if not found /// </summary> /// <returns></returns> private Vector3 GetGoodPointUnidirectionnal(Vector3 p, Vector3 foundPosition) { //Vector3 projectedOnPlane = TriPlane.Project(EdgeAb.A, TriNorm.normalized, p); Vector3 dirPlayer = p - foundPosition; float dotPlanePlayer = ExtVector3.DotProduct(dirPlayer.normalized, TriNorm.normalized); if ((dotPlanePlayer < 0 && !inverseDirection) || dotPlanePlayer > 0 && inverseDirection) { return(foundPosition); } else { Debug.DrawRay(p, dirPlayer, Color.yellow, 5f); Debug.DrawRay(p, TriNorm.normalized, Color.black, 5f); return(ExtVector3.GetNullVector()); } }
//public bool IsAbove(Vector3 q) => Direction.Dot(q - Point) > 0; public bool IsAbove(Vector3 q) => ExtVector3.DotProduct(q - Point, Direction) > 0;
public double Project(Vector3 p) => ExtVector3.DotProduct(Delta, p - A) / LengthSquared;