I have two doors and Both of them opened in a different direction
Any help?
The code
void UopenDoorR0::BeginPlay()
{
Super::BeginPlay();
InitialYaw = GetOwner()->GetActorRotation().Yaw;
CurrentYaw = InitialYaw;
TargetYaw =90.f + InitialYaw;
}
// Called every frame
void UopenDoorR0::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
UE_LOG(LogTemp,Error,TEXT("%s"),*GetOwner()->GetActorRotation().ToString());
UE_LOG(LogTemp,Warning,TEXT("%f"),GetOwner()->GetActorRotation().Yaw);
CurrentYaw = FMath::FInterpTo(CurrentYaw, TargetYaw, DeltaTime, 2);
FRotator DoorRotation= GetOwner()->GetActorRotation();
DoorRotation.Yaw = CurrentYaw;
GetOwner()->SetActorRotation(DoorRotation);
}