diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f015967f..6a8789c87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- [UUM-133861] Fixed "Look rotation viewing vector is zero" log being spammed when holding shift while using a create tool such as Create Sprite. + ## [6.0.9] - 2026-01-30 ### Fixed diff --git a/Editor/EditorCore/DrawShapeTool.cs b/Editor/EditorCore/DrawShapeTool.cs index 1cf259414..8ad2c37e2 100644 --- a/Editor/EditorCore/DrawShapeTool.cs +++ b/Editor/EditorCore/DrawShapeTool.cs @@ -844,6 +844,11 @@ internal void SetBounds(Vector3 size) m_BB_HeightCorner = m_BB_Origin + size; } + void UpdatePlaneRotation() + { + m_PlaneRotation = Mathf.Approximately(m_PlaneForward.sqrMagnitude, 0f) ? Quaternion.identity : Quaternion.LookRotation(m_PlaneForward, m_Plane.normal); + } + internal void DoDuplicateShapePreviewHandle(Vector3 position) { var evt = Event.current; @@ -868,7 +873,7 @@ internal void DoDuplicateShapePreviewHandle(Vector3 position) m_Bounds.center = cornerPosition + new Vector3(size.x / 2f, 0, size.z / 2f) + (size.y / 2f) * m_Plane.normal; var lastPreviewRotation = m_PlaneRotation; - m_PlaneRotation = Quaternion.LookRotation(m_PlaneForward, m_Plane.normal); + UpdatePlaneRotation(); var forceRebuildPreview = !m_PlaneRotation.Equals(lastPreviewRotation) || m_LastPreviewPivotLocation != pivotLocation; m_LastPreviewPivotLocation = pivotLocation; @@ -919,7 +924,7 @@ internal void DoDuplicateShapePreviewHandle(Vector3 position) pivot += .5f * size.y * m_Plane.normal; else pivot = previewPivotPosition; - m_DuplicateGO.transform.SetPositionAndRotation(pivot, Quaternion.LookRotation(m_PlaneForward, m_Plane.normal)); + m_DuplicateGO.transform.SetPositionAndRotation(pivot, m_PlaneRotation); DrawBoundingBox(preview_BB_Origin, preview_BB_HeightCorner, preview_BB_OppositeCorner, false); } @@ -943,7 +948,7 @@ void RecalculateBounds() if(Mathf.Abs(m_Bounds.center.y) < 0.0001f) m_Bounds.center = m_Bounds.center + 0.0001f * Vector3.up; - m_PlaneRotation = Quaternion.LookRotation(m_PlaneForward,m_Plane.normal); + UpdatePlaneRotation(); } internal void RebuildShape()