private void OnEnable() { _sphereHandle.SetColor(EditorConstants.PRIMARY_COLOR); _sphereHandle.midpointHandleDrawFunction = null; _surface = (target as SphereSurface); }
private void DrawSurfaceVolume(SphereSurface surface) { Handles.color = INTERACTABLE_COLOR; Vector3 startLine = surface.Centre; Vector3 endLine = startLine + surface.Rotation * Vector3.forward * surface.Radious; Handles.DrawDottedLine(startLine, endLine, 5); }
private void DrawSphereEditor(SphereSurface surface) { _sphereHandle.radius = surface.Radius; _sphereHandle.center = surface.Centre; EditorGUI.BeginChangeCheck(); _sphereHandle.DrawHandle(); }
private void DrawSurfaceVolume(SphereSurface surface) { Handles.color = EditorConstants.PRIMARY_COLOR; Vector3 startLine = surface.Centre; Vector3 endLine = startLine + surface.Rotation * Vector3.forward * surface.Radius; Handles.DrawDottedLine(startLine, endLine, 5); }
private void DrawCentre(SphereSurface surface) { EditorGUI.BeginChangeCheck(); Quaternion handleRotation = (surface.RelativeTo ?? surface.transform).rotation; Vector3 centrePosition = Handles.PositionHandle(surface.Centre, handleRotation); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(surface, "Change Centre Sphere Position"); surface.Centre = centrePosition; } }
public void OnSceneGUI() { SphereSurface surface = (target as SphereSurface); DrawCentre(surface); Handles.color = Color.white; DrawSphereEditor(surface); if (Event.current.type == EventType.Repaint) { DrawSurfaceVolume(surface); } }