private bool ProjectPointByCastingRay(Vector3 raycastOrigin, Vector3 raycastDirection, out Vector3 projectedPoint) { projectedPoint = Vector3.zero; Octave3DColliderRayHit colliderRayHit; Ray ray = new Ray(raycastOrigin, raycastDirection); if (_collider.RaycastBothDirections(ray, out colliderRayHit)) { projectedPoint = colliderRayHit.HitPoint + _planeOfPointsToProject.normal * _projectedPointOffset; return(true); } return(false); }
private List <Plane> GetPlanesOnWhichOrientedBoxResides(OrientedBox worldOrientedBox) { if (HasCursorPickedTerrainObject()) { List <Vector3> boxCenterAndCornerPoints = worldOrientedBox.GetCenterAndCornerPoints(); var planes = new List <Plane>(boxCenterAndCornerPoints.Count); Octave3DColliderRayHit colliderRayHit; Octave3DCollider hitCollider = _cursorRayHit.ClosestObjectRayHit.HitCollider; foreach (Vector3 boxPoint in boxCenterAndCornerPoints) { Ray ray = new Ray(boxPoint, Normal); if (hitCollider.RaycastBothDirections(ray, out colliderRayHit)) { planes.Add(new Plane(colliderRayHit.HitNormal, colliderRayHit.HitPoint)); } else { planes.Add(Plane); } } return(planes); } return(new List <Plane> { Plane }); }