So i try to create a collectable that increases the movement speed of the character. The Actor that i created for that collectable is supposed to rotate, so its prettier.
// Called every frame
void APickup::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FRotator Pickup_Current_Rotation = GetActorRotation();
GEngine->AddOnScreenDebugMessage(-10, 0.5f, FColor::Green, FString::Printf(TEXT("Z %f ; X %f ; Y %f"), Pickup_Current_Rotation.Yaw, Pickup_Current_Rotation.Roll, Pickup_Current_Rotation.Pitch));
FRotator Pickup_Rotation = Pickup_Base_Rotation + (Rotation_Ratio * Pickup_Rotator);
if (Pickup_Rotation == Pickup_Base_Rotation)
{
Pickup_Rotator += FRotator(90.0f, 90.0f, 90.0f);
Rotation_Ratio += 1;
}
if (Pickup_Current_Rotation == Pickup_Rotation)
{
GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Blue, TEXT("Success"));
Rotation_Ratio += 1;
}
if (GetActorRotation() == FRotator(360.0f, 360.0f, 360.0f))
{
SetActorRotation(FRotator(0.0f, 0.0f, 0.0f));
}
SetActorRotation(FMath::RInterpConstantTo(Pickup_Current_Rotation, Pickup_Rotation, DeltaTime, 50.0f));
Pickup_Update_Rotation = GetActorRotation();
}
I tried multiple things, so i know that the issue is that, “if (Pickup_Current_Rotation == Pickup_Rotation)” isnt matching the requierments at any point. But i dont understand why it is like that. I tried for multiple hours and im just tired at this point. Im begging for help.
oh, and fyi it stops rotating at FRotator(90.0f, 90.0f, 90.0f).
Thanks in advance
