コード例 #1
0
        public static bool FindSurfaceIntersection(CSGBrush brush, Matrix4x4 modelTransformation, Int32 surfaceIndex, Vector2 screenPos, out LegacySurfaceIntersection intersection)
        {
            var worldRay  = HandleUtility.GUIPointToWorldRay(screenPos);
            var rayStart  = worldRay.origin;
            var rayVector = (worldRay.direction * (Camera.current.farClipPlane - Camera.current.nearClipPlane));
            var rayEnd    = rayStart + rayVector;

            return(FindSurfaceIntersection(brush, modelTransformation, surfaceIndex, rayStart, rayEnd, out intersection));
        }
コード例 #2
0
        public static bool FindSurfaceIntersection(CSGBrush brush, Matrix4x4 modelTransformation, Int32 surfaceIndex, Vector3 rayStart, Vector3 rayEnd, out LegacySurfaceIntersection intersection)
        {
            intersection = null;
            if (!brush ||
                InternalCSGModelManager.External.RayCastIntoBrushSurface == null)
            {
                return(false);
            }

            if (!InternalCSGModelManager.External.RayCastIntoBrushSurface(brush.brushNodeID,
                                                                          surfaceIndex,
                                                                          rayStart,
                                                                          rayEnd,
                                                                          modelTransformation,
                                                                          out intersection))
            {
                return(false);
            }

            if (BrushTraits.IsSurfaceSelectable(brush, surfaceIndex))
            {
                return(false);
            }
            return(true);
        }
コード例 #3
0
        public static bool FindSurfaceIntersection(Camera camera, CSGBrush brush, Matrix4x4 modelTransformation, Int32 surfaceIndex, Vector2 screenPos, out LegacySurfaceIntersection intersection)
        {
            var worldRay  = HandleUtility.GUIPointToWorldRay(screenPos);
            var rayStart  = worldRay.origin;
            var rayVector = (worldRay.direction * (camera.farClipPlane - camera.nearClipPlane));
            var rayEnd    = rayStart + rayVector;

            intersection = null;
            if (!brush ||
                InternalCSGModelManager.External.RayCastIntoBrushSurface == null)
            {
                return(false);
            }

            if (!InternalCSGModelManager.External.RayCastIntoBrushSurface(brush.brushNodeID,
                                                                          surfaceIndex,
                                                                          rayStart,
                                                                          rayEnd,
                                                                          modelTransformation,
                                                                          out intersection))
            {
                return(false);
            }

            if (BrushTraits.IsSurfaceUnselectable(brush, surfaceIndex, brush.ChildData.Model.IsTrigger))
            {
                return(false);
            }
            return(true);
        }