From b33b7cf9d3fe863ef8c492dc5f1a4274fabd4f44 Mon Sep 17 00:00:00 2001 From: "j.foucher" Date: Sat, 11 Apr 2026 12:46:49 +0200 Subject: [PATCH] Revert rotation to simple perpendicular approach The magnitude+sign approach caused confusing direction changes. Back to perpendicular-only: only the mouse axis perpendicular to the projected rotation axis drives rotation. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../PS_Editor/GameMode/PS_Editor_Pawn.cpp | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/Unreal/Plugins/PS_Editor/Source/PS_Editor/GameMode/PS_Editor_Pawn.cpp b/Unreal/Plugins/PS_Editor/Source/PS_Editor/GameMode/PS_Editor_Pawn.cpp index e4dc834..06f88b9 100644 --- a/Unreal/Plugins/PS_Editor/Source/PS_Editor/GameMode/PS_Editor_Pawn.cpp +++ b/Unreal/Plugins/PS_Editor/Source/PS_Editor/GameMode/PS_Editor_Pawn.cpp @@ -363,24 +363,9 @@ void APS_Editor_Pawn::HandleLook(const FInputActionValue& Value) DragPC->ProjectWorldLocationToScreen(GizmoDragPlaneOrigin, ScreenStart); DragPC->ProjectWorldLocationToScreen(GizmoDragPlaneOrigin + AxisDir * 100.0f, ScreenEnd); - const float ScreenLen = (ScreenEnd - ScreenStart).Size(); - - // Use perpendicular for DIRECTION (sign), total mouse for SPEED - // This way both X and Y always contribute, no dead zones - float PerpDot = 0.0f; - if (ScreenLen > 1.0f) - { - FVector2D ScreenAxisDir = (ScreenEnd - ScreenStart) / ScreenLen; - FVector2D ScreenPerp(-ScreenAxisDir.Y, ScreenAxisDir.X); - PerpDot = LookInput.X * ScreenPerp.X - LookInput.Y * ScreenPerp.Y; - } - else - { - PerpDot = LookInput.X + LookInput.Y; - } - - const float MouseMagnitude = FMath::Abs(LookInput.X) + FMath::Abs(LookInput.Y); - AngleDelta = -FMath::Sign(PerpDot) * MouseMagnitude * RotationSpeed; + FVector2D ScreenAxisDir = (ScreenEnd - ScreenStart).GetSafeNormal(); + FVector2D ScreenPerp(-ScreenAxisDir.Y, ScreenAxisDir.X); + AngleDelta = -(LookInput.X * ScreenPerp.X - LookInput.Y * ScreenPerp.Y) * RotationSpeed; } GizmoDragAccumulator += AngleDelta;