Hi,
I’m having a problem with my character not rotating when he goes around a corner in game.
if (Actor1Position.X <= -900 && ActorCount == 4 && GetCurrentState() != ETypingRunPlayState::EGameOver && GetCurrentState() != ETypingRunPlayState::EWordRequired)
{
FRotator CharacterRotation = TypingRunCharacter->GetActorRotation();
if (bTurnLeft == false)
{
turnWait += 1;
if (bRotated == false)
{
SetCurrentState(ETypingRunPlayState::ERotateRight);
CharacterRotation.Yaw += 90 * DeltaSeconds;
TypingRunCharacter->SetActorRotation(CharacterRotation);
bRotated = true;
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Rotate right"));
}
}
else
{
turnWait += 1;
if (bRotated == false)
{
SetCurrentState(ETypingRunPlayState::ERotateLeft);
CharacterRotation.Yaw -= 90 * DeltaSeconds;
TypingRunCharacter->SetActorRotation(CharacterRotation);
bRotated = true;
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Rotate left"));
}
}
if (turnWait >= 105)
{
turnWait = 0;
PlatformMover();
if (bTurnLeft == false)
{
CharacterRotation.Yaw -= 90 * DeltaSeconds;
TypingRunCharacter->SetActorRotation(CharacterRotation);
}
else
{
CharacterRotation.Yaw += 90 * DeltaSeconds;
TypingRunCharacter->SetActorRotation(CharacterRotation);
}
bRotated = false;
}
Any ideas? It’s definitely running the other statements in the Ifs so I don’t see why it won’t rotate my character…
Thanks in advance