public static bool Raycast(Vector3 origin, Vector3 direction, SurfaceMask surfaceMask, float maxDistance) { SpatialUnderstandingDll.Imports.RaycastResult rayCastResult; if (SpatialUnderstanding.Instance.AllowSpatialUnderstanding && SpatialUnderstanding.Instance.ScanState == SpatialUnderstanding.ScanStates.Done) { // Set result pointer IntPtr raycastResultPtr = SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticRaycastResultPtr(); // Shoot Raycast SpatialUnderstandingDll.Imports.PlayspaceRaycast(origin.x, origin.y, origin.z, direction.x, direction.y, direction.z, raycastResultPtr); // Assign temp result rayCastResult = SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticRaycastResult(); // Check Surface Mask return(CheckSurfaceAgainstMask(rayCastResult.SurfaceType, surfaceMask)); } return(false); }
public static bool Raycast(Vector3 origin, Vector3 direction, SurfaceMask surfaceMask) { return(Raycast(origin, direction, surfaceMask, Mathf.Infinity)); }
public static bool Raycast(Ray ray, out RaycastHit_SU hitInfo, SurfaceMask surfaceMask, float maxDistance) { return(Raycast(ray.origin, ray.direction, out hitInfo, surfaceMask, maxDistance)); }
public static bool Raycast(Ray ray, SurfaceMask surfaceMask, float maxDistance) { return(Raycast(ray.origin, ray.direction, surfaceMask, maxDistance)); }
public static bool Raycast(Ray ray, SurfaceMask surfaceMask) { return(Raycast(ray.origin, ray.direction, surfaceMask)); }
private static bool CheckSurfaceAgainstMask(SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes surface, SurfaceMask mask) { if (surface != SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.Invalid) { switch (surface) { case SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.Other: return(mask.Other); case SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.Floor: return(mask.Floor); case SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.FloorLike: return(mask.FloorLike); case SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.Platform: return(mask.Platform); case SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.Ceiling: return(mask.Ceiling); case SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.WallExternal: return(mask.WallExternal); case SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.WallLike: return(mask.WallLike); default: return(false); } } else { return(false); } }
public static bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit_SU hitInfo, SurfaceMask surfaceMask) { return(Raycast(origin, direction, out hitInfo, surfaceMask, Mathf.Infinity)); }