Hey there:
I have a C++ door which have:
FrameComponent (RootComponent)
DoorComponent (Attached to RootComponent)
Then I have a blueprint which father is this “Door” in order to have designers working with it.
When I print relative rotation and world rotation of DoorComponent both are the same. That means that I cannot rotate the blueprint or my door will not work as I programmed in C++. I’m attaching screenshots of the rotating function in C++, the blueprint and the prints of relative rotation and world rotation.
C++ code:
//STATES ROTATION
if (StatesEnum == EDoorStates::DS_CLOSED && FMath::Abs(DoorComponent->RelativeRotation.Yaw - 0.0f) >= 1.0f)
DoorComponent->SetRelativeRotation(FRotator(0.0f, UKismetMathLibrary::FInterpEaseInOut(DoorComponent->RelativeRotation.Yaw, 0.0f, DeltaTime, 0.8f), 0.0f));
else if (StatesEnum == EDoorStates::DS_POSHALFOPENED && FMath::Abs(DoorComponent->RelativeRotation.Yaw - 35.0f) >= 5.0f)
DoorComponent->SetRelativeRotation(FRotator(0.0f, UKismetMathLibrary::FInterpEaseInOut(DoorComponent->RelativeRotation.Yaw, 30.0f, DeltaTime, 0.8f), 0.0f));
else if (StatesEnum == EDoorStates::DS_POSOPENED && FMath::Abs(DoorComponent->RelativeRotation.Yaw - 90.0f) >= 5.0f)
DoorComponent->SetRelativeRotation(FRotator(0.0f, UKismetMathLibrary::FInterpEaseInOut(DoorComponent->RelativeRotation.Yaw, 90.0f, DeltaTime, 0.8f), 0.0f));
else if (StatesEnum == EDoorStates::DS_NEGHALFOPENED && FMath::Abs(DoorComponent->RelativeRotation.Yaw - (-35.0f)) >= 5.0f)
DoorComponent->SetRelativeRotation(FRotator(0.0f, UKismetMathLibrary::FInterpEaseInOut(DoorComponent->RelativeRotation.Yaw, -30.0f, DeltaTime, 0.8f), 0.0f));
else if (StatesEnum == EDoorStates::DS_NEGOPENED && FMath::Abs(DoorComponent->RelativeRotation.Yaw - (-90.0f)) >= 5.0f)
DoorComponent->SetRelativeRotation(FRotator(0.0f, UKismetMathLibrary::FInterpEaseInOut(DoorComponent->RelativeRotation.Yaw, -90.0f, DeltaTime, 0.8f), 0.0f));
else
bRotatingDoorEvent = false;
Blueprint screenshot:
Gameplay screenshot. In red the relative rotation, in blue the world rotation:
Thank you so much in advance!
Regards,
j0s3m4.