Tried something different, but it worked :| :D

void UOpenDoor::BeginPlay()
{
	Super::BeginPlay();
	InitialYaw = GetOwner()->GetActorRotation().Yaw;
	TargetYaw = InitialYaw + OpeningAngle;
	CurrentYaw = InitialYaw;


	// ...
	
}


// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
	
	CurrentYaw = FMath::FInterpConstantTo(GetOwner()->GetActorRotation().Yaw, TargetYaw, DeltaTime, 45);

	//Create the new rotated position
	FRotator NewRotation(0.f, CurrentYaw, 0.f);
	//Set the rotation to the new rotation.

	if (NewRotation.Yaw != TargetYaw)
	{
		GetOwner()->SetActorRotation(NewRotation);
	}

Privacy & Terms