コード例 #1
0
        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);
        }
コード例 #2
0
 public static bool Raycast(Vector3 origin, Vector3 direction, SurfaceMask surfaceMask)
 {
     return(Raycast(origin, direction, surfaceMask, Mathf.Infinity));
 }
コード例 #3
0
 public static bool Raycast(Ray ray, out RaycastHit_SU hitInfo, SurfaceMask surfaceMask, float maxDistance)
 {
     return(Raycast(ray.origin, ray.direction, out hitInfo, surfaceMask, maxDistance));
 }
コード例 #4
0
 public static bool Raycast(Ray ray, SurfaceMask surfaceMask, float maxDistance)
 {
     return(Raycast(ray.origin, ray.direction, surfaceMask, maxDistance));
 }
コード例 #5
0
 public static bool Raycast(Ray ray, SurfaceMask surfaceMask)
 {
     return(Raycast(ray.origin, ray.direction, surfaceMask));
 }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
 public static bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit_SU hitInfo, SurfaceMask surfaceMask)
 {
     return(Raycast(origin, direction, out hitInfo, surfaceMask, Mathf.Infinity));
 }