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){
74 auto RootComponent = Component;
75 if (RootComponent !=
nullptr)
78 RootComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
103 auto Controller = Cast<AWheeledVehicleAIController>(Vehicle->GetController());
106 SpeedLimit = Controller->GetSpeedLimit();
122 if (!bAckermannControlActive)
131 auto Controller = Cast<AWheeledVehicleAIController>(Vehicle->GetController());
134 Controller->SetSpeedLimit(SpeedLimit);
143 auto Walker = Cast<AWalkerBase>(
Actor);
144 auto Controller = Walker !=
nullptr ? Cast<AWalkerController>(Walker->GetController()) :
nullptr;
145 if (Controller !=
nullptr)
149 bAlive = Walker->bAlive;
156 auto Walker = Cast<ACharacter>(
Actor);
157 auto Controller = Walker !=
nullptr ? Cast<AWalkerController>(Walker->GetController()) :
nullptr;
158 if (Controller !=
nullptr)
160 Controller->ApplyWalkerControl(WalkerControl);
162 auto CharacterMovement = Cast<UCharacterMovementComponent>(Walker->GetCharacterMovement());
169 FActorSpawnParameters SpawnParams;
170 SpawnParams.SpawnCollisionHandlingOverride =
171 ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
182 Model = Actor->GetClass();
184 USignComponent* TrafficSignComponent =
185 Cast<USignComponent>(TrafficSign->FindComponentByClass<USignComponent>());
186 if (TrafficSignComponent)
188 SignModel = TrafficSignComponent->GetClass();
189 SignId = TrafficSignComponent->GetSignId();
198 USignComponent* SignComponent =
199 NewObject<USignComponent>(
Actor, SignModel);
200 SignComponent->SetSignId(
SignId);
201 SignComponent->RegisterComponent();
202 SignComponent->AttachToComponent(
203 Actor->GetRootComponent(),
204 FAttachmentTransformRules::KeepRelativeTransform);
206 SignComponent->InitializeSign(GameMode->
GetMap().get());
213 FActorSpawnParameters SpawnParams;
214 SpawnParams.SpawnCollisionHandlingOverride =
215 ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
226 Model = Actor->GetClass();
229 SignId = Component->GetSignId();
230 Controller = Component->GetController();
231 Controller->RemoveTrafficLight(Component);
232 Controller->AddCarlaActorTrafficLight(CarlaActor);
242 Component->SetSignId(
SignId);
243 Controller->RemoveCarlaActorTrafficLight(CarlaActor);
244 Controller->AddTrafficLight(Component);
246 Component->InitializeSign(GameMode->
GetMap().get());
247 Component->SetLightState(Controller->GetCurrentState().State);
void ApplyVehicleControl(const FVehicleControl &Control, EVehicleInputPriority Priority)
virtual void RecordActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
carla::rpc::VehicleFailureState GetFailureState() const
virtual void RestoreActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode) override
UTrafficLightComponent * GetTrafficLightComponent()
FVehiclePhysicsControl GetVehiclePhysicsControl() const
virtual void RecordActorData(FCarlaActor *CarlaActor, UCarlaEpisode *CarlaEpisode)
bool IsAckermannControlActive() const
void SetSimulatePhysics(bool enabled)
void ApplyVehicleAckermannControl(const FVehicleAckermannControl &AckermannControl, EVehicleInputPriority Priority)
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
void SetFailureState(const carla::rpc::VehicleFailureState &FailureState)
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.
FAckermannControllerSettings GetAckermannControllerSettings() const
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.
const FVehicleAckermannControl & GetVehicleAckermannControl() const
Vehicle Ackermann control currently applied to this vehicle.
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.
void ApplyAckermannControllerSettings(const FAckermannControllerSettings &AckermannControllerSettings)
A view over an actor and its properties.
FVehicleLightState GetVehicleLightState() const