I just downloaded UE4 yesterday, and to learn more about the software I decided to start from a blank project and try to recreate the ue4 default flying controller. I copied the “MoveRight()” code from the flying preset to mine, however when I trigger this function, it only turns to a certain degree instead of turning continuously. It’s probably something really simple that I forgot. Here is how it looks like: https://streamable.com/gsnupg
My MoveRight function:
void AShip::MoveRight(float Val)
{
float targetYaw = Val * TurnSpeed;
CurrentYawSpeed = FMath::FInterpTo(CurrentYawSpeed, targetYaw, GetWorld()->GetDeltaSeconds(), 2.0f);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("targetYaw: %f"), targetYaw));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("currentYawSpeed: %f"), CurrentYawSpeed));
bool isTurning = FMath::Abs(Val) > 0.2f;
float targetRollSpeed = isTurning ? (CurrentYawSpeed * 0.5f) : (GetActorRotation().Roll * -2.0f);
CurrentRollSpeed = FMath::FInterpTo(CurrentRollSpeed, targetRollSpeed, GetWorld()->GetDeltaSeconds(), 2.0f);
}
Original MoveRight function:
My Tick function:
void AShip::Tick(float DeltaTime)
{
const FVector LocalMove = FVector(CurrentForwardSpeed * DeltaTime, 0.f, 0.f);
AddActorLocalOffset(LocalMove, true);
FRotator deltaRotation(0, 0, 0);
deltaRotation.Pitch = CurrentPitchSpeed * DeltaTime;
deltaRotation.Yaw = CurrentYawSpeed * DeltaTime;
deltaRotation.Roll = CurrentRollSpeed * DeltaTime;
AddActorLocalRotation(deltaRotation);
Super::Tick(DeltaTime);
}
Original Tick function: void ASpaceFlightPawn::Tick(float DeltaSeconds){ const FVector LocalMove = F - Pastebin.com
What could I miss?