public NavigationMode_Teleport(TeleportUI teleportObject, TrajectoryParams trajectoryP)
 {
     teleport             = teleportObject;
     teleportRay          = teleport.transform.Find("Ray").GetComponent <LineRenderer>();
     teleportTargetObject = teleport.transform.Find("Target");
     trajectoryParams     = trajectoryP;
 }
        public static bool ComputeTrajectory(Vector3 rayStartPosition, Vector3 rayStartDirection, TrajectoryParams tParams, out List <Vector3> points, out RaycastHit hitInfo)
        {
            points = new List <Vector3>();
            Ray startRay = new Ray();

            startRay.origin    = rayStartPosition;
            startRay.direction = rayStartDirection;

            var   aimPosition  = startRay.origin;
            var   aimDirection = startRay.direction * tParams.aimVelocity;
            var   rangeSquared = tParams.range * tParams.range / GlobalState.WorldScale;
            bool  hit;
            float step = tParams.aimStep;

            int layerMask = ~(1 << 5);

            do
            {
                Vector3 oldAimPosition = aimPosition;
                points.Add(aimPosition);

                var aimVector = aimDirection;
                aimVector.y  = aimVector.y + tParams.gravity * 0.0111111111f * step;
                aimDirection = aimVector;
                aimPosition += aimVector * step;
                hit          = Physics.Raycast(oldAimPosition, (aimPosition - oldAimPosition).normalized, out hitInfo, (aimPosition - oldAimPosition).magnitude, layerMask);
            } while (!hit && (aimPosition.y - startRay.origin.y > tParams.minimumElevation / GlobalState.WorldScale) && ((startRay.origin - aimPosition).sqrMagnitude <= rangeSquared));

            return(hit);
        }