16 #include "GameFramework/CharacterMovementComponent.h" 26 SpawnTransform.AddToTranslation(FVector(0,0,15));
33 FTransform
Transform = Actor->GetTransform();
36 Scale = Transform.GetScale3D();
53 Component->SetPhysicsLinearVelocity(
55 Component->SetPhysicsAngularVelocityInDegrees(
59 auto* CarlaVehicle = Cast<ACarlaWheeledVehicle>(
Actor);
61 if (CarlaVehicle !=
nullptr){
68 auto CharacterMovement = Cast<UCharacterMovementComponent>(
Character->GetCharacterMovement());
71 CharacterMovement->SetDefaultMovementMode();
74 CharacterMovement->DisableMovement();
81 auto RootComponent = Component;
82 if (RootComponent !=
nullptr)
85 RootComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
107 auto Controller = Cast<AWheeledVehicleAIController>(Vehicle->GetController());
110 SpeedLimit = Controller->GetSpeedLimit();
126 auto Controller = Cast<AWheeledVehicleAIController>(Vehicle->GetController());
129 Controller->SetSpeedLimit(SpeedLimit);
137 auto Walker = Cast<APawn>(
Actor);
138 auto Controller = Walker !=
nullptr ? Cast<AWalkerController>(Walker->GetController()) :
nullptr;
139 if (Controller !=
nullptr)
149 auto Walker = Cast<APawn>(
Actor);
150 auto Controller = Walker !=
nullptr ? Cast<AWalkerController>(Walker->GetController()) :
nullptr;
151 if (Controller !=
nullptr)
153 Controller->ApplyWalkerControl(WalkerControl);
160 FActorSpawnParameters SpawnParams;
161 SpawnParams.SpawnCollisionHandlingOverride =
162 ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
173 Model = Actor->GetClass();
175 USignComponent* TrafficSignComponent =
176 Cast<USignComponent>(TrafficSign->FindComponentByClass<USignComponent>());
177 if (TrafficSignComponent)
179 SignModel = TrafficSignComponent->GetClass();
180 SignId = TrafficSignComponent->GetSignId();
189 USignComponent* SignComponent =
190 NewObject<USignComponent>(
Actor, SignModel);
191 SignComponent->SetSignId(
SignId);
192 SignComponent->RegisterComponent();
193 SignComponent->AttachToComponent(
194 Actor->GetRootComponent(),
195 FAttachmentTransformRules::KeepRelativeTransform);
197 SignComponent->InitializeSign(GameMode->
GetMap().get());
204 FActorSpawnParameters SpawnParams;
205 SpawnParams.SpawnCollisionHandlingOverride =
206 ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
217 Model = Actor->GetClass();
220 SignId = Component->GetSignId();
221 Controller = Component->GetController();
222 Controller->RemoveTrafficLight(Component);
223 Controller->AddCarlaActorTrafficLight(CarlaActor);
233 Component->SetSignId(
SignId);
234 Controller->RemoveCarlaActorTrafficLight(CarlaActor);
235 Controller->AddTrafficLight(Component);
237 Component->InitializeSign(GameMode->
GetMap().get());
238 Component->SetLightState(Controller->GetCurrentState().State);
void ApplyVehicleControl(const FVehicleControl &Control, EVehicleInputPriority Priority)
virtual void RecordActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
virtual void RestoreActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
UTrafficLightComponent * GetTrafficLightComponent()
FVehiclePhysicsControl GetVehiclePhysicsControl() const
virtual void RecordActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode)
void SetSimulatePhysics(bool enabled)
virtual AActor * RespawnActor(UCarlaEpisode *CarlaEpisode, const FActorInfo &Info)
virtual void RestoreActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
ETrafficLightState GetTrafficLightState() const
virtual AActor * RespawnActor(UCarlaEpisode *CarlaEpisode, const FActorInfo &Info) override
virtual void RecordActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
static ACarlaGameModeBase * GetGameMode(const UObject *WorldContextObject)
void ApplyVehiclePhysicsControl(const FVehiclePhysicsControl &PhysicsControl)
carla::SharedPtr< cc::Actor > Actor
const FVehicleControl & GetVehicleControl() const
Vehicle control currently applied to this vehicle.
const boost::optional< carla::road::Map > & GetMap() const
detail::Stream< detail::MultiStreamState > Stream
A stream represents an unidirectional channel for sending data from server to client.
FActorDescription Description
FIntVector GetCurrentMapOrigin() const
FTransform GetLocalTransform(UCarlaEpisode *CarlaEpisode) const
virtual void RestoreActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
virtual void RestoreActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
void SetVehicleLightState(const FVehicleLightState &LightState)
FDataStream MoveDataStream()
virtual void RecordActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
virtual AActor * RespawnActor(UCarlaEpisode *CarlaEpisode, const FActorInfo &Info) override
virtual void RestoreActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
A view over an actor and its properties.
Base class for the CARLA Game Mode.
virtual void RestoreActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode)
void SetDataStream(FDataStream InStream)
Replace the FDataStream associated with this sensor.
virtual void RecordActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
AActor * ReSpawnActorWithInfo(const FTransform &Transform, FActorDescription thisActorDescription)
Spawns an actor based on ActorDescription at Transform.
virtual void RecordActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
Base class for CARLA wheeled vehicles.
void SetTrafficLightState(ETrafficLightState State)
void SetPoleIndex(int InPoleIndex)
geom::Transform Transform
AActor * SpawnActor(const FTransform &Transform, FActorDescription ActorDescription)
Spawns an actor based on ActorDescription at Transform.
A view over an actor and its properties.
FVehicleLightState GetVehicleLightState() const