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) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 12:46:49 +02:00
parent 76d2ccd249
commit b33b7cf9d3

View File

@@ -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 ScreenAxisDir = (ScreenEnd - ScreenStart).GetSafeNormal();
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;
AngleDelta = -(LookInput.X * ScreenPerp.X - LookInput.Y * ScreenPerp.Y) * RotationSpeed;
}
GizmoDragAccumulator += AngleDelta;