Modify movement to feel more intuitive (align with direction faster)

This commit is contained in:
2025-02-17 16:17:44 +05:30
parent b815c07878
commit 4b588e8667
3 changed files with 73 additions and 26 deletions

View File

@@ -60,6 +60,13 @@ protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement")
float DragCoefficient = 0.05f;
// How quickly velocity aligns with new direction
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement", meta = (ClampMin = "0.0", ClampMax = "10.0"))
float VelocityAlignmentSpeed = 4.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement", meta = (ClampMin = "0.0", ClampMax = "1.0", ToolTip = "How much of the current velocity is maintained when changing direction (0 = none, 1 = full)"))
float DirectionalInertia = 0.3f;
// Input functions
void HandleThrottleStarted(const FInputActionValue& Value);
void HandleThrottleReleased(const FInputActionValue& Value);
@@ -81,4 +88,7 @@ private:
FVector2D MouseDeltaSmoothed;
FVector2D LastMouseDelta;
float MouseSmoothingSpeed = 10.0f;
bool bWasThrottlePressed;
FVector DesiredVelocityDirection;
};