mirror of
https://github.com/storytold/EventCenterPlugin.git
synced 2026-10-09 00:09:42 +00:00
better comments / cleanup
This commit is contained in:
@@ -39,29 +39,22 @@ void ASpawningActor::Tick(float DeltaTime)
|
||||
|
||||
void ASpawningActor::Spawn()
|
||||
{
|
||||
// Spawn actor
|
||||
// TODO(bt): This will memory leak.
|
||||
ASpawnableActor* spawnedActor = (ASpawnableActor*)GetWorld()->SpawnActor(ASpawnableActor::StaticClass());
|
||||
|
||||
// Teleport actor randomly
|
||||
// TODO(bt): Put this in front of the camera, or on the (camera -> player) arc!
|
||||
float x = FMath::RandRange(-1000.0f, 1000.0f);
|
||||
float y = FMath::RandRange(-1000.0f, 1000.0f);
|
||||
float z = FMath::RandRange(-1000.0f, 1000.0f);
|
||||
|
||||
FVector location(x, y, z);
|
||||
FRotator rotation;
|
||||
|
||||
/*ASpawnableActor* spawnedActor = (ASpawnableActor*)GetWorld()->SpawnActor(
|
||||
ASpawnableActor::StaticClass(),
|
||||
NAME_None,
|
||||
&location,
|
||||
&rotation,
|
||||
nullptr, // ??
|
||||
false, // bNoCollisionFail
|
||||
false, // ??
|
||||
nullptr, // owner
|
||||
nullptr // instigator
|
||||
);*/
|
||||
|
||||
// TODO(bt): This will memory leak.
|
||||
ASpawnableActor* spawnedActor = (ASpawnableActor*)GetWorld()->SpawnActor(ASpawnableActor::StaticClass());
|
||||
spawnedActor->SetActorLocationAndRotation(location, rotation, false, 0, ETeleportType::ResetPhysics);
|
||||
|
||||
// We don't want to keep the actor around indefinitely since they may pile up unused.
|
||||
// Optionally, we could maintain a queue and cull the oldest actors.
|
||||
spawnedActor->StartDestroyTimer(10.0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user