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:
@@ -363,24 +363,9 @@ void APS_Editor_Pawn::HandleLook(const FInputActionValue& Value)
|
|||||||
DragPC->ProjectWorldLocationToScreen(GizmoDragPlaneOrigin, ScreenStart);
|
DragPC->ProjectWorldLocationToScreen(GizmoDragPlaneOrigin, ScreenStart);
|
||||||
DragPC->ProjectWorldLocationToScreen(GizmoDragPlaneOrigin + AxisDir * 100.0f, ScreenEnd);
|
DragPC->ProjectWorldLocationToScreen(GizmoDragPlaneOrigin + AxisDir * 100.0f, ScreenEnd);
|
||||||
|
|
||||||
const float ScreenLen = (ScreenEnd - ScreenStart).Size();
|
FVector2D ScreenAxisDir = (ScreenEnd - ScreenStart).GetSafeNormal();
|
||||||
|
|
||||||
// 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);
|
FVector2D ScreenPerp(-ScreenAxisDir.Y, ScreenAxisDir.X);
|
||||||
PerpDot = LookInput.X * ScreenPerp.X - LookInput.Y * ScreenPerp.Y;
|
AngleDelta = -(LookInput.X * ScreenPerp.X - LookInput.Y * ScreenPerp.Y) * RotationSpeed;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PerpDot = LookInput.X + LookInput.Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float MouseMagnitude = FMath::Abs(LookInput.X) + FMath::Abs(LookInput.Y);
|
|
||||||
AngleDelta = -FMath::Sign(PerpDot) * MouseMagnitude * RotationSpeed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GizmoDragAccumulator += AngleDelta;
|
GizmoDragAccumulator += AngleDelta;
|
||||||
|
|||||||
Reference in New Issue
Block a user