Lecture #88 - OpenDoor Class suggestion

Hi,
In my opinion, leaving the code as-is is just bad practice.

void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
	if (GetTotalMassOfActorsOnPlate() > 30.f) // TODO make into a parameter
	{
		OpenDoor();
		LastDoorOpenTime = GetWorld()->GetTimeSeconds();
	}
	// ........
}

Simply because we keep checking for that overlapping Actors within every tick!
I would expect the chapter to end with this improvement.

Privacy & Terms