Chose rising door instead of swinging

I don’t use many variables, but it seems to work…

void UOpenDoor1::BeginPlay()
{
Super::BeginPlay();
TargetZ = GetOwner()->GetActorLocation().Z + 320;
}

// Called every frame
void UOpenDoor1::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

UE_LOG(LogTemp, Log, TEXT(“Height is: %f.”), GetOwner()->GetActorLocation().Z);

FVector OpenDoor = GetOwner()->GetActorLocation();
OpenDoor.Z = FMath::FInterpTo (OpenDoor.Z, TargetZ, DeltaTime, 2);
GetOwner()->SetActorLocation(OpenDoor);

if (TargetZ - OpenDoor.Z < 1)
{
SetComponentTickEnabled(false);
UE_LOG(LogTemp, Warning, TEXT(“Door Open”));
}
}