CARLA
 
载入中...
搜索中...
未找到
UtilActorFactory.cpp
浏览该文件的文档.
1// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#include "UtilActorFactory.h"
8
12
13TArray<FActorDefinition> AUtilActorFactory::GetDefinitions()
14{
16 auto StaticMeshDefinition = ABFL::MakeGenericDefinition(
17 TEXT("util"),
18 TEXT("actor"),
19 TEXT("empty"));
20 StaticMeshDefinition.Class = AEmptyActor::StaticClass();
21
22 return { StaticMeshDefinition };
23}
24
26 const FTransform &SpawnAtTransform,
27 const FActorDescription &ActorDescription)
28{
30 auto *World = GetWorld();
31 if (World == nullptr)
32 {
33 UE_LOG(LogCarla, Error, TEXT
34 ("AUtilActorFactory: cannot spawn mesh into an empty world."));
35 return {};
36 }
37
38 FActorSpawnParameters SpawnParameters;
39 SpawnParameters.SpawnCollisionHandlingOverride =
40 ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
41
42 auto *StaticMeshActor = World->SpawnActor<AEmptyActor>(
43 ActorDescription.Class, SpawnAtTransform, SpawnParameters);
44
45 return FActorSpawnResult(StaticMeshActor);
46}
TArray< FActorDefinition > GetDefinitions() final
Retrieve the definitions of the static mesh actor
FActorSpawnResult SpawnActor(const FTransform &SpawnAtTransform, const FActorDescription &ActorDescription) final
Spawn an actor based on ActorDescription and Transform.
A description of a Carla Actor with all its variation.
TSubclassOf< AActor > Class
Class of the actor to be spawned.
Result of an actor spawn function.