Hi there,
I came up with a slightly different solution that results in my door revolving constantly if I set the InitialYaw to above ~130 degrees. Anyone have any ideas as to why?
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();
InitialYaw = GetOwner()->GetActorRotation().Yaw;
TargetYaw = InitialYaw + TargetYaw;
}
// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
UE_LOG(LogTemp, Warning, TEXT("%s"), *GetOwner()->GetActorRotation().ToString());
UE_LOG(LogTemp, Warning, TEXT("Yaw: %f"), GetOwner()->GetActorRotation().Yaw);
CurrentYaw = GetOwner()->GetActorRotation().Yaw;
FRotator OpenDoor(0.f, TargetYaw, 0.f);
OpenDoor.Yaw = FMath::FInterpTo(CurrentYaw, TargetYaw, DeltaTime, 2);
GetOwner()->SetActorRotation(OpenDoor);
}