public static Vector3 GetMousePosWithMoveSpace(Ray ray, Vector2 guiMousePos, MovingSpace pathSpace, float planeHeight) { float dst = 0; if (pathSpace == MovingSpace.XY) { dst = (planeHeight - ray.origin.z) / ray.direction.z; return(ray.origin + ray.direction * dst); } dst = (planeHeight - ray.origin.y) / ray.direction.y; return(ray.origin + ray.direction * dst); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.HelpBox(helpInfo, MessageType.Info); DrawInspectorForTransportWithTransformAndIsClose(); if (!transportWithTransformInEditor) { smoothLine.resolation = EditorGUILayout.IntSlider("Resolation", smoothLine.resolation, 1, 40); movingSpace = (MovingSpace)EditorGUILayout.Popup("Moving Space", (int)movingSpace, MovingSpaceName); smoothLine.useSnap = EditorGUILayout.Toggle("Use Snap", smoothLine.useSnap); if (smoothLine.useSnap) { smoothLine.snapValue = EditorGUILayout.FloatField("Snap Value", smoothLine.snapValue); } openVisualSettingPanel = EditorGUILayout.Foldout(openVisualSettingPanel, "Visual Settings"); if (openVisualSettingPanel) { smoothLine.visualSetting.nodeRadius = EditorGUILayout.FloatField("Node Radius", smoothLine.visualSetting.nodeRadius); smoothLine.visualSetting.anchorRadius = EditorGUILayout.FloatField("Anchor Radius", smoothLine.visualSetting.anchorRadius); smoothLine.visualSetting.showPathNotSelected = EditorGUILayout.Toggle("Show Path Not Selected", smoothLine.visualSetting.showPathNotSelected); } DrawInspectorForRadius(); if (GUILayout.Button("Reset")) { Undo.RecordObject(smoothLine, "Reset Smooth Line"); smoothLine.Reset(movingSpace); SceneView.RepaintAll(); } } if (isDoubleClickNode && smoothLine.transform.hasChanged) { smoothLine.UpdateNode(lastSelectedNodeIndex, smoothLine.transform.position); GUI.changed = true; } if (GUI.changed) { smoothLine.ConvertToSmoothCurve(); SceneView.RepaintAll(); } }
void ChangeSpace() { movingSpace = (MovingSpace)(1 - (int)movingSpace); }