# Keeping momentum when turning?

It appears the FVector LocalMove is automatically rotated with my forward vector when turning, so the velocity’s direction stays relative to where I look rather than to the world.

void AMyPawn::Tick(float DeltaSeconds)
{
// const FRotator rot(10, 10, 10);
// FVector result = rot.RotateVector(FVector(1, 0, 0));

LocalMove.X = CurrentForwardSpeed * DeltaSeconds;
LocalMove.Y = CurrentHorizontalSpeed * DeltaSeconds;
LocalMove.Z = CurrentVerticalSpeed * DeltaSeconds;

DeltaRotation.Pitch = CurrentPitchSpeed * DeltaSeconds;
DeltaRotation.Yaw = CurrentYawSpeed * DeltaSeconds;
DeltaRotation.Roll = CurrentRollSpeed * DeltaSeconds;

//LocalMove = DeltaRotation.RotateVector(LocalMove);
//LocalMove = GetActorForwardVector();

// Call any parent class Tick implementation
Super::Tick(DeltaSeconds);

}

Here’s how I calculate the CurrentSpeeds:

void AMyPawn::MoveVertical(float Val)
{
float CurrentAcc = (Val * Acceleration);
// Calculate new speed
float NewVerticalSpeed = CurrentVerticalSpeed + (GetWorld()->GetDeltaSeconds() * CurrentAcc);
// Clamp between MinSpeed and MaxSpeed
CurrentVerticalSpeed = FMath::Clamp(NewVerticalSpeed, MinSpeed, MaxSpeed);
}

void AMyPawn::RotateForward(float Val)
{
// Target pitch speed is based in input
float TargetRollSpeed = (Val * TurnSpeed * -1.f);

// When steering, we decrease pitch slightly
TargetRollSpeed += (FMath::Abs(CurrentYawSpeed) * -0.2f);

// Smoothly interpolate to target pitch speed
CurrentRollSpeed = FMath::FInterpTo(CurrentRollSpeed, TargetRollSpeed, GetWorld()->GetDeltaSeconds(), 5.f);
}

Should I somehow create another FVector that is relative to the world rotation and calculate the force on each axis using trig and my ForwardRotation/ForwardVector, or is there a nicer solution I haven’t seen? The commented out lines in the tick method are lines I used to try to fix the issue to no avail.