public void OnScene(TerrainToolEditor editor, SceneView sceneview) { if (Reticle == null) { Reticle = editor.LoadReticle <ReticleLinesForEditor>("ReticleLinesForEditor"); } if (Event.current.control || Event.current.type == EventType.MouseDown && Event.current.button == 1) { startPosition = null; } var hit = editor.GetIntersectionWithTerrain(true); if (hit.HasValue) { var p = hit.Value.point - new Vector3(0, Height * 0.5f, Width * 0.5f); Vector3 vL, vH, vW; if (startPosition.HasValue) { UMath.ComputeEdgeVectors(startPosition.Value, p, Width, Height, out vL, out vH, out vW); Reticle.SetCornerAndEdges(startPosition.Value, vL, vH, vW); } else { UMath.ComputeEdgeVectors(p, p + Vector3.forward, Width, Height, out vL, out vH, out vW); Reticle.SetCornerAndEdges(p, vL, vH, vW); } if (editor.Clicking) { Event.current.Use(); if (!startPosition.HasValue) { startPosition = p; } else { editor.PerformOperation(CreateOperationFromEditor(startPosition.Value, p, editor), sceneview); startPosition = null; } } } }
public void OnScene(TerrainToolEditor editor, SceneView sceneview) { if (Reticle == null) { Reticle = editor.LoadReticle <SphericalReticleForEditor>("SphericalReticleForEditor"); } var hit = editor.GetIntersectionWithTerrain(true); if (hit.HasValue) { Reticle.SetPositionAndSize(hit.Value.point, Radius); } if (editor.Clicking) { Event.current.Use(); editor.PerformOperation(CreateOperationFromEditor(Reticle.transform.position, editor), sceneview); } }
public void OnScene(TerrainToolEditor editor, SceneView sceneview) { if (Reticle == null) { Reticle = editor.LoadReticle <CylinderReticleForEditor>("CylinderReticleForEditor"); } if (Event.current.control || Event.current.type == EventType.MouseDown && Event.current.button == 1) { startPosition = null; } var hit = editor.GetIntersectionWithTerrain(true); if (hit.HasValue) { var p = hit.Value.point; if (startPosition.HasValue) { Reticle.SetPositionsAndRadius(startPosition.Value, hit.Value.point, Radius); } else { Reticle.SetPositionsAndRadius(hit.Value.point, hit.Value.point + Vector3.right, Radius); } if (editor.Clicking) { Event.current.Use(); if (!startPosition.HasValue) { startPosition = p; } else { editor.PerformOperation(CreateOperationFromEditor(startPosition.Value, p, editor), sceneview); startPosition = null; } } } }