void Update() { cursorMaterial.color = Normal; if (Input.GetKeyUp(ControlScheme.Cancel)) { CursorUI.Init(); } if (CursorUI.IsActive() == false) { if (InputManager.StartPressed() || InputManager.BackPressed()) { CursorUI.Save(); } } UpdateZoom(); int cursorHitLayer = 1 << (int)TrackMask.Terrain; var hit = RaycastAgainstTerrain(cursorHitLayer); terrainEditor.BrushRenderer.enabled = false; Renderer.enabled = true; //TODO CLAMP if (hit.collider != null) { raycastPos = new Vector3(hit.point.x, 10, hit.point.z); transform.position = hit.point; transform.up = Vector3.Lerp(transform.up, hit.normal, Time.deltaTime * 10); transform.RotateAround(transform.position, transform.up, transform.localEulerAngles.y); } switch (EditMode) { case EditMode.TerrainHeightMap: Renderer.enabled = false; terrainEditor.UpdateTerrainHeightMap(); break; case EditMode.TerrainTexture: Renderer.enabled = false; terrainEditor.UpdateTerrainTexture(); break; case EditMode.Objects: MoveObjects(); break; default: break; } }