CARLA
Loading...
Searching...
No Matches
List of all members
ACarlaWheeledVehicle Class Reference

Base class for CARLA wheeled vehicles. More...

#include <CarlaWheeledVehicle.h>

+ Inheritance diagram for ACarlaWheeledVehicle:

Public Member Functions

Constructor and destructor
 ACarlaWheeledVehicle (const FObjectInitializer &ObjectInitializer)
 
 ~ACarlaWheeledVehicle ()
 
Get functions
UChaosWheeledVehicleMovementComponent * GetChaosWheeledVehicleMovementComponent () const
 Get chaos wheeled vehicle movement component casted.
 
const FVehicleControl & GetVehicleControl () const
 Vehicle control currently applied to this vehicle.
 
const FVehicleAckermannControl & GetVehicleAckermannControl () const
 Vehicle Ackermann control currently applied to this vehicle.
 
FTransform GetVehicleTransform () const
 Transform of the vehicle.
 
float GetVehicleForwardSpeed () const
 Forward speed in cm/s. Might be negative if goes backwards.
 
FVector GetVehicleOrientation () const
 Orientation vector of the vehicle, pointing forward.
 
int32 GetVehicleCurrentGear () const
 Active gear of the vehicle.
 
FTransform GetVehicleBoundingBoxTransform () const
 Transform of the vehicle's bounding box relative to the vehicle.
 
FVector GetVehicleBoundingBoxExtent () const
 Extent of the vehicle's bounding box.
 
UBoxComponent * GetVehicleBoundingBox () const
 Get vehicle's bounding box component.
 
float GetMaximumSteerAngle () const
 Get the maximum angle at which the front wheel can steer.
 
Vehicle input control
void ApplyVehicleControl (const FVehicleControl &Control, EVehicleInputPriority Priority)
 
void ApplyVehicleAckermannControl (const FVehicleAckermannControl &AckermannControl, EVehicleInputPriority Priority)
 
bool IsAckermannControlActive () const
 
void ActivateVelocityControl (const FVector &Velocity)
 
void DeactivateVelocityControl ()
 
void ActivateAccelerationControl (const FVector &Acceleration)
 
void DeactivateAccelerationControl ()
 
void ApplyVehicleAccelerationControl (float LongitudinalAccelerationMps2, float Steer, float SteerSpeed)
 Apply control from Autoware /control/command/control_cmd (acceleration [m/s^2] + steering)
 
void ShowDebugTelemetry (bool Enabled)
 
void FlushVehicleControl ()
 
DEPRECATED Set functions
void SetThrottleInput (float Value)
 
void SetSteeringInput (float Value)
 
void SetBrakeInput (float Value)
 
void SetReverse (bool Value)
 
void ToggleReverse ()
 
void SetHandbrakeInput (bool Value)
 
void HoldHandbrake ()
 
void ReleaseHandbrake ()
 
TArray< float > GetWheelsFrictionScale ()
 
void SetWheelsFrictionScale (TArray< float > &WheelsFrictionScale)
 
void SetCarlaMovementComponent (UBaseCarlaMovementComponent *MoementComponent)
 
template<typename T = UBaseCarlaMovementComponent>
T * GetCarlaMovementComponent () const
 

AI debug state

FName RiderMeshComponentName = TEXT("SkeletalMesh")
 Two-wheeled vehicles (bikes/motorcycles) embed their rider as a SkeletalMeshComponent (named RiderMeshComponentName) meant to sit on VehicleMeshSeatSocketName.
 
FName VehicleMeshSeatSocketName = TEXT("Seat")
 
float RiderSeatSmoothingSpeed = 10.0f
 Chaos suspension has small, real, high-frequency vertical jitter on the vehicle mesh every frame (visible as the rider's torso/hip bouncing, the seat popping the rider up) – physically real, not a bug, but the seat-lock's hard snap transmits it 1:1 to the rider with zero smoothing.
 
FRotator RiderSeatRelativeRotationOffset = FRotator(0.0f, -90.0f, 15.0f)
 The rider mesh's rest pose isn't authored to sit flush with the socket's own local axes – its component template ships with this exact relative rotation baked in (no translation), so the seat-lock composes it on top of the socket's world transform instead of using the bare socket transform, which twisted the pose.
 
float PedalRotationDegreesPerCm = 0.5f
 Degrees the pedal bone rotates per centimeter of real vehicle travel (see GetPedalRotation).
 
void SetAIVehicleState (ECarlaWheeledVehicleState InState)
 
ECarlaWheeledVehicleState GetAIVehicleState () const
 
FVehiclePhysicsControl GetVehiclePhysicsControl () const
 
FVehicleTelemetryData GetVehicleTelemetryData () const
 Returns a snapshot of the vehicle's runtime telemetry: forward speed, last applied control inputs, engine RPM, current gear, and per-wheel lateral slip, longitudinal slip, and angular velocity sourced from the Chaos vehicle physics state.
 
FVector GetCenterOfMass (UChaosWheeledVehicleMovementComponent &VehicleMovComponent) const
 
FAckermannControllerSettings GetAckermannControllerSettings () const
 
void RestoreVehiclePhysicsControl ()
 
FVehicleLightState GetVehicleLightState () const
 
void ApplyVehiclePhysicsControl (const FVehiclePhysicsControl &PhysicsControl)
 
void SetCenterOfMass (UChaosWheeledVehicleMovementComponent &VehicleMovComponent, const FVehiclePhysicsControl &PhysicsControl)
 
void ApplyAckermannControllerSettings (const FAckermannControllerSettings &AckermannControllerSettings)
 
void SetSimulatePhysics (bool enabled)
 
void SetVehicleLightState (const FVehicleLightState &LightState)
 
void SetFailureState (const carla::rpc::VehicleFailureState &FailureState)
 
bool IsTwoWheeledVehicle ()
 
virtual bool IsTwoWheeledVehicle_Implementation ()
 
FTransform GetCachedVehicleSocketWorldTransform (FName SocketName) const
 Cached, extrapolated world transform of ANY socket on the vehicle mesh (Seat, HandlerLeftSocket, HandlerRightSocket, LeftPedalSocket, RightPedalSocket, ...), captured from OnRiderBoneTransformsFinalized (which fires late enough in the frame to reliably see this frame's real, physics-updated position – confirmed by logging it against the vehicle's actual movement, always smooth, never stale).
 
float GetPedalRotation () const
 Two-wheeled vehicles spin a decorative pedal/crank bone (in the vehicle mesh's own Anim Blueprint, unrelated to the rider) via a looping Timeline whose curve doesn't start and end at the same value – every loop the Timeline restarts, the bone's rotation pops instantly back to the curve's start value instead of continuing smoothly, and the rider's foot IK (which targets a socket on that bone) pops along with it.
 
void PrintROS2Message (const char *Message)
 

Overriden from AActor

struct { 
 
   FVehicleControl   Control 
 
   FVehicleLightState   LightState 
 
   EVehicleInputPriority   Priority = EVehicleInputPriority::INVALID 
 
} InputControl 
 
float DetectionSize { 750.0f }
 
FBox FoliageBoundingBox
 
TObjectPtr< UBoxComponent > VehicleBounds
 
float CarSimOriginOffset = 150.f
 
bool bIsNWVehicle = false
 
float SpeedAnim { 0.0f }
 
float RotationAnim { 0.0f }
 
FPoseSnapshot WorldTransformedPose
 
TArray< FName > ConstraintComponentNames
 
float DoorOpenStrength = 100.0f
 
ECarlaWheeledVehicleState State = ECarlaWheeledVehicleState::UNKNOWN
 Current state of the vehicle controller (for debugging purposes).
 
TObjectPtr< UVehicleVelocityControl > VelocityControl
 
TObjectPtr< UVehicleAccelerationControl > AccelerationControl
 
FVehicleControl LastAppliedControl
 
FVehicleAckermannControl LastAppliedAckermannControl
 
FVehiclePhysicsControl LastPhysicsControl
 
bool bAckermannControlActive = false
 
FAckermannController AckermannController
 
float RolloverBehaviorForce = 0.35
 
int RolloverBehaviorTracker = 0
 
float RolloverFlagTime = 5.0f
 
carla::rpc::VehicleFailureState FailureState = carla::rpc::VehicleFailureState::None
 
bool bHasSavedVehicleLightDefault = false
 
float SavedVehicleLightIntensity = 1.0f
 
TMap< FString, float > SavedVehicleLightGroupIntensity
 
TObjectPtr< USkeletalMeshComponent > RiderMeshComponent = nullptr
 
TObjectPtr< USkeletalMeshComponent > VehicleMeshForRiderSeat = nullptr
 
bool bRiderComponentsResolved = false
 
TMap< FName, FTransform > CachedVehicleSocketTransforms
 
FTransform CachedVehicleMeshTransform
 
FVector CachedVehicleWorldVelocity = FVector::ZeroVector
 
FVector CachedVehicleWorldAngularVelocityDegrees = FVector::ZeroVector
 
float CachedVehicleTransformsTimeSeconds = 0.0f
 
FTransform SmoothedVehicleMeshTransform
 
bool bSmoothedVehicleMeshTransformInitialized = false
 
float PedalRotationAngle = 0.0f
 
bool bHasMirroredMotion = false
 
FVector MirroredVelocity = FVector::ZeroVector
 
float MirroredForwardSpeed = 0.0f
 
bool bHasMirroredGear = false
 
int32 MirroredGear = 0
 
bool bMirroredManualGearShift = false
 
bool bMirroredSimulatingPhysics = false
 
bool bPhysicsEnabled = true
 
UBaseCarlaMovementComponent * BaseMovementComponent = nullptr
 
TArray< UPhysicsConstraintComponent * > ConstraintsComponents
 
bool bWheelAnimationOverridden = false
 
TArray< FWheelAnimationData > OverriddenWheelPoses
 
TArray< float > PendingSeedSpins
 Degrees, as drawn.
 
bool bSeedStepStarted = false
 
FDelegateHandle SeedPreTickHandle
 
FDelegateHandle SeedPostTickHandle
 
TMap< UPhysicsConstraintComponent *, UPrimitiveComponent * > ConstraintDoor
 
TMap< UPrimitiveComponent *, FTransform > DoorComponentsTransform
 
TMap< UPrimitiveComponent *, UPhysicsConstraintComponent * > CollisionDisableConstraints
 
FTimerHandle TimerHandler
 
FBox GetDetectionBox () const
 
float GetDetectionSize () const
 
void UpdateDetectionBox ()
 
const TArray< int32 > GetFoliageInstancesCloseToVehicle (const UInstancedStaticMeshComponent *Component) const
 
void DrawFoliageBoundingBox () const
 
FBoxSphereBounds GetBoxSphereBounds () const
 
bool IsInVehicleRange (const FVector &Location) const
 
void SetWheelSteerDirection (EVehicleWheelLocation WheelLocation, float AngleInDeg)
 Set the rotation of the car wheels indicated by the user 0 = FL_VehicleWheel, 1 = FR_VehicleWheel, 2 = BL_VehicleWheel, 3 = BR_VehicleWheel NOTE : This is purely aesthetic.
 
float GetWheelSteerAngle (EVehicleWheelLocation WheelLocation)
 
void SetWheelPitchAngle (EVehicleWheelLocation WheelLocation, float AngleInDeg)
 Spin angle of a wheel, in degrees. Purely visual, wheel animation override only.
 
float GetWheelPitchAngle (EVehicleWheelLocation WheelLocation)
 
void SetWheelSuspensionOffset (EVehicleWheelLocation WheelLocation, float OffsetInCm)
 Suspension compression of a wheel, in cm.
 
float GetWheelSuspensionOffset (EVehicleWheelLocation WheelLocation)
 
void SetWheelAnimationOverride (bool bEnabled)
 While the wheel animation is overridden the wheels show only the values set through the wheel setters, whether or not Chaos simulates the vehicle.
 
bool IsWheelAnimationOverridden () const
 
const TArray< FWheelAnimationData > & GetOverriddenWheelPoses () const
 Indexed like the movement component's WheelSetups.
 
bool IsSimulatedByChaos () const
 Whether the Chaos vehicle simulation is moving this vehicle.
 
bool HasWheel (int32 WheelIndex) const
 
bool HasCarlaVehicleAnimation () const
 Whether the animation blueprint derives from UCarlaVehicleAnimationInstance, which is what draws the overridden wheel poses.
 
float GetWheelRadius (int32 WheelIndex) const
 Radius of the wheel at WheelIndex, in cm, as last applied through the physics control.
 
FVector GetWheelSuspensionAxis (int32 WheelIndex) const
 Unit vector, component space, along which the wheel's suspension drops.
 
FWheelAnimationData GetDrawnWheelPose (int32 WheelIndex) const
 Wheel pose the animation instance drew this frame (else GetWheelPose); what secondaries must draw.
 
void OpenDoor (const EVehicleDoor DoorIdx)
 
void CloseDoor (const EVehicleDoor DoorIdx)
 
void OpenDoorPhys (const EVehicleDoor DoorIdx)
 
void CloseDoorPhys (const EVehicleDoor DoorIdx)
 
void RecordDoorChange (const EVehicleDoor DoorIdx, const bool bIsOpen)
 
TArray< TPair< int32, FTransform > > GetOpenDoorPoses () const
 Every door open now (a physics body of its own while open), by door index, with its pose relative to the vehicle.
 
void SetMirroredDoorPoses (const TArray< TPair< int32, FTransform > > &OpenDoors)
 Multi-GPU secondary: shows these doors open, at these poses relative to the vehicle, and every other door closed.
 
virtual FVector GetVelocity () const override
 
void SetMirroredMotion (const FVector &Velocity, float ForwardSpeed)
 Multi-GPU secondary: the primary's motion of the vehicle this one mirrors (world frame, cm/s), which GetVelocity and GetVehicleForwardSpeed report instead of this body's: a mirror never moves on its own.
 
void ClearMirroredMotion ()
 
bool HasMirroredMotion () const
 
void SetMirroredDrivetrain (int32 Gear, bool bManualGearShift, bool bSimulatingPhysics)
 Multi-GPU secondary: the primary's gear, which GetVehicleCurrentGear reports instead of the idle drivetrain's, its manual gear shift, and whether the primary's body simulates physics.
 
bool GetMirroredManualGearShift () const
 
bool IsMirroredSimulatingPhysics () const
 
FPoseSnapshot GetWorldTransformedPose ()
 
void SetRolloverFlag ()
 
carla::rpc::VehicleFailureState GetFailureState () const
 
float GetSpeedAnim () const
 
void SetSpeedAnim (float Speed)
 
float GetRotationAnim () const
 
void SetRotationAnim (float Rotation)
 
virtual void BeginPlay () override
 
virtual void TickActor (float DeltaTime, enum ELevelTick TickType, FActorTickFunction &ThisTickFunction) override
 
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason)
 
void RefreshLightState (const FVehicleLightState &VehicleLightState)
 
void AdjustVehicleBounds ()
 
void ResetConstraints ()
 
void ApplyWheelPhysicsControl ()
 Applies LastPhysicsControl.Wheels to the live Chaos wheels.
 
void ApplyVehicleLightDefaultsForCurrentState ()
 
void ResolveRiderComponentsIfNeeded ()
 
void OnRiderBoneTransformsFinalized ()
 
FWheelAnimationData * GetOverriddenWheelPoseOrWarn (EVehicleWheelLocation WheelLocation, const TCHAR *Caller)
 The overridden pose for a setter to write, or nullptr, with a warning, if it cannot be set.
 
bool HasWheelOrWarn (int32 WheelIndex, const TCHAR *Caller) const
 
const UChaosVehicleWheel * GetSimulatedWheel (int32 WheelIndex) const
 The Chaos wheel, while Chaos simulates the vehicle and has output for it.
 
FWheelAnimationData GetWheelPose (int32 WheelIndex) const
 The pose shown for a wheel: the overridden one, otherwise Chaos's, otherwise the one last drawn.
 
TArray< FWheelAnimationData > GetWheelPoses () const
 GetWheelPose for every wheel.
 
void SeedChaosWheels (const TArray< FWheelAnimationData > &Poses)
 Sets the Chaos wheels to these poses, so that they do not jump when Chaos takes over the wheels again.
 
void ArmSeedRewrite (TArray< float > Spins)
 The next physics pre-tick copies in the output of the step before the seed, so the seeded spins are written again when that frame's physics ends.
 
void DisarmSeedRewrite ()
 
void OnSeedPreTick (FPhysScene_Chaos *Scene, float DeltaSeconds)
 
void OnSeedPostTick (FChaosScene *Scene)
 
const UChaosVehicleWheel * GetWheelDefaults (int32 WheelIndex) const
 
void ApplyRolloverBehavior ()
 Rollovers tend to have too much angular velocity, resulting in the vehicle doing a full 360º flip.
 
void CheckRollover (const float roll, const std::pair< float, float > threshold_roll)
 
void AddReferenceToManager ()
 
void RemoveReferenceToManager ()
 
void ActivateVehicleLightComponents ()
 Some vehicle Blueprints (Tesla, Mustang, DodgeCharger, ...) author real Spot/Point light components for their headlights instead of relying on emissive materials alone, but those components are not wrapped in a UCarlaLight – so they never got UE5's bAutoActivate=false activation fix or the UE4-to-UE5 photometric intensity conversion (see CarlaLight.h).
 
static FRotator GetPhysicsConstraintAngle (UPhysicsConstraintComponent *Component)
 
static void SetPhysicsConstraintAngle (UPhysicsConstraintComponent *Component, const FRotator &NewAngle)
 

Detailed Description

Base class for CARLA wheeled vehicles.

Definition at line 84 of file CarlaWheeledVehicle.h.

Constructor & Destructor Documentation

◆ ACarlaWheeledVehicle()

ACarlaWheeledVehicle::ACarlaWheeledVehicle ( const FObjectInitializer &  ObjectInitializer)

◆ ~ACarlaWheeledVehicle()

ACarlaWheeledVehicle::~ACarlaWheeledVehicle ( )

Definition at line 85 of file CarlaWheeledVehicle.cpp.

Member Function Documentation

◆ ActivateAccelerationControl()

void ACarlaWheeledVehicle::ActivateAccelerationControl ( const FVector &  Acceleration)

Definition at line 1122 of file CarlaWheeledVehicle.cpp.

References AccelerationControl.

◆ ActivateVehicleLightComponents()

void ACarlaWheeledVehicle::ActivateVehicleLightComponents ( )
private

Some vehicle Blueprints (Tesla, Mustang, DodgeCharger, ...) author real Spot/Point light components for their headlights instead of relying on emissive materials alone, but those components are not wrapped in a UCarlaLight – so they never got UE5's bAutoActivate=false activation fix or the UE4-to-UE5 photometric intensity conversion (see CarlaLight.h).

Applies both fixes directly to this actor's light components.

Definition at line 197 of file CarlaWheeledVehicle.cpp.

References ApplyVehicleLightDefaultsForCurrentState(), bHasSavedVehicleLightDefault, CVarCarlaVehicleBeamIntensityScale(), ULightDefaultsJsonUtils::LoadVehicleLightDefault(), SavedVehicleLightGroupIntensity, and SavedVehicleLightIntensity.

Referenced by BeginPlay().

◆ ActivateVelocityControl()

void ACarlaWheeledVehicle::ActivateVelocityControl ( const FVector &  Velocity)

Definition at line 1112 of file CarlaWheeledVehicle.cpp.

References VelocityControl.

◆ AddReferenceToManager()

void ACarlaWheeledVehicle::AddReferenceToManager ( )
private

Definition at line 1859 of file CarlaWheeledVehicle.cpp.

References AVegetationManager::AddVehicle(), and IsValid().

Referenced by BeginPlay().

◆ AdjustVehicleBounds()

void ACarlaWheeledVehicle::AdjustVehicleBounds ( )
protected

◆ ApplyAckermannControllerSettings()

void ACarlaWheeledVehicle::ApplyAckermannControllerSettings ( const FAckermannControllerSettings &  AckermannControllerSettings)
inline

Definition at line 211 of file CarlaWheeledVehicle.h.

◆ ApplyRolloverBehavior()

void ACarlaWheeledVehicle::ApplyRolloverBehavior ( )
private

Rollovers tend to have too much angular velocity, resulting in the vehicle doing a full 360º flip.

This function progressively reduces the vehicle's angular velocity so that it ends up upside down instead.

Definition at line 1812 of file CarlaWheeledVehicle.cpp.

References CheckRollover(), FailureState, GetVehicleTransform(), carla::rpc::None, RolloverBehaviorTracker, RolloverFlagTime, SetRolloverFlag(), and TimerHandler.

◆ ApplyVehicleAccelerationControl()

void ACarlaWheeledVehicle::ApplyVehicleAccelerationControl ( float  LongitudinalAccelerationMps2,
float  Steer,
float  SteerSpeed 
)

Apply control from Autoware /control/command/control_cmd (acceleration [m/s^2] + steering)

Definition at line 1132 of file CarlaWheeledVehicle.cpp.

References AccelerationControl, AckermannController, bAckermannControlActive, InputControl, FAckermannController::Reset(), and VelocityControl.

◆ ApplyVehicleAckermannControl()

void ACarlaWheeledVehicle::ApplyVehicleAckermannControl ( const FVehicleAckermannControl &  AckermannControl,
EVehicleInputPriority  Priority 
)

◆ ApplyVehicleControl()

void ACarlaWheeledVehicle::ApplyVehicleControl ( const FVehicleControl &  Control,
EVehicleInputPriority  Priority 
)

◆ ApplyVehicleLightDefaultsForCurrentState()

void ACarlaWheeledVehicle::ApplyVehicleLightDefaultsForCurrentState ( )
private

◆ ApplyVehiclePhysicsControl()

void ACarlaWheeledVehicle::ApplyVehiclePhysicsControl ( const FVehiclePhysicsControl &  PhysicsControl)

◆ ApplyWheelPhysicsControl()

void ACarlaWheeledVehicle::ApplyWheelPhysicsControl ( )
private

◆ ArmSeedRewrite()

void ACarlaWheeledVehicle::ArmSeedRewrite ( TArray< float >  Spins)
private

The next physics pre-tick copies in the output of the step before the seed, so the seeded spins are written again when that frame's physics ends.

Definition at line 1441 of file CarlaWheeledVehicle.cpp.

References bSeedStepStarted, DisarmSeedRewrite(), OnSeedPostTick(), OnSeedPreTick(), PendingSeedSpins, SeedPostTickHandle, and SeedPreTickHandle.

Referenced by SeedChaosWheels().

◆ BeginPlay()

void ACarlaWheeledVehicle::BeginPlay ( )
overrideprotectedvirtual

◆ CheckRollover()

void ACarlaWheeledVehicle::CheckRollover ( const float  roll,
const std::pair< float, float >  threshold_roll 
)
private

Definition at line 1839 of file CarlaWheeledVehicle.cpp.

References RolloverBehaviorForce, and RolloverBehaviorTracker.

Referenced by ApplyRolloverBehavior().

◆ ClearMirroredMotion()

void ACarlaWheeledVehicle::ClearMirroredMotion ( )

◆ CloseDoor()

void ACarlaWheeledVehicle::CloseDoor ( const EVehicleDoor  DoorIdx)

Definition at line 1682 of file CarlaWheeledVehicle.cpp.

References All, CloseDoorPhys(), and ConstraintsComponents.

◆ CloseDoorPhys()

void ACarlaWheeledVehicle::CloseDoorPhys ( const EVehicleDoor  DoorIdx)

◆ DeactivateAccelerationControl()

void ACarlaWheeledVehicle::DeactivateAccelerationControl ( )

Definition at line 1127 of file CarlaWheeledVehicle.cpp.

References AccelerationControl.

◆ DeactivateVelocityControl()

void ACarlaWheeledVehicle::DeactivateVelocityControl ( )

Definition at line 1117 of file CarlaWheeledVehicle.cpp.

References VelocityControl.

◆ DisarmSeedRewrite()

void ACarlaWheeledVehicle::DisarmSeedRewrite ( )
private

◆ DrawFoliageBoundingBox()

void ACarlaWheeledVehicle::DrawFoliageBoundingBox ( ) const

Definition at line 602 of file CarlaWheeledVehicle.cpp.

References FoliageBoundingBox.

◆ EndPlay()

void ACarlaWheeledVehicle::EndPlay ( const EEndPlayReason::Type  EndPlayReason)
protectedvirtual

Definition at line 1657 of file CarlaWheeledVehicle.cpp.

References DisarmSeedRewrite(), and RemoveReferenceToManager().

◆ FlushVehicleControl()

void ACarlaWheeledVehicle::FlushVehicleControl ( )

◆ GetAckermannControllerSettings()

FAckermannControllerSettings ACarlaWheeledVehicle::GetAckermannControllerSettings ( ) const
inline

Definition at line 197 of file CarlaWheeledVehicle.h.

◆ GetAIVehicleState()

ECarlaWheeledVehicleState ACarlaWheeledVehicle::GetAIVehicleState ( ) const
inline

Definition at line 179 of file CarlaWheeledVehicle.h.

References State.

◆ GetBoxSphereBounds()

FBoxSphereBounds ACarlaWheeledVehicle::GetBoxSphereBounds ( ) const

◆ GetCachedVehicleSocketWorldTransform()

FTransform ACarlaWheeledVehicle::GetCachedVehicleSocketWorldTransform ( FName  SocketName) const
inline

Cached, extrapolated world transform of ANY socket on the vehicle mesh (Seat, HandlerLeftSocket, HandlerRightSocket, LeftPedalSocket, RightPedalSocket, ...), captured from OnRiderBoneTransformsFinalized (which fires late enough in the frame to reliably see this frame's real, physics-updated position – confirmed by logging it against the vehicle's actual movement, always smooth, never stale).

The rider's Anim Blueprint should read this instead of querying the vehicle mesh's sockets itself (directly, or via a vehicle-side variable computed that way) for EVERY seat/handler/pedal target used in its Data Gather: that independent read, from the Blueprint's own Event BlueprintUpdateAnimation, intermittently races ahead of the physics update and returns last frame's transform instead – confirmed first on the seat (fixed the torso pop) and then on the same pattern showing up on the handler/pedal sockets driving the arm/leg IK (hands/feet still popping to a stale pose after the torso fix). This trades that flickering race for a lag that's constant instead of intermittent, then extrapolates it away using the linear velocity it was cached with – all vehicle-mesh sockets share that velocity, moving rigidly together, so one shared velocity/timestamp covers every socket looked up here.

Definition at line 296 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ GetCarlaMovementComponent()

template<typename T = UBaseCarlaMovementComponent>
T * ACarlaWheeledVehicle::GetCarlaMovementComponent ( ) const
inline

Definition at line 523 of file CarlaWheeledVehicle.h.

◆ GetCenterOfMass()

FVector ACarlaWheeledVehicle::GetCenterOfMass ( UChaosWheeledVehicleMovementComponent &  VehicleMovComponent) const

Definition at line 920 of file CarlaWheeledVehicle.cpp.

Referenced by GetVehiclePhysicsControl().

◆ GetChaosWheeledVehicleMovementComponent()

UChaosWheeledVehicleMovementComponent * ACarlaWheeledVehicle::GetChaosWheeledVehicleMovementComponent ( ) const
inline

◆ GetDetectionBox()

FBox ACarlaWheeledVehicle::GetDetectionBox ( ) const

Definition at line 591 of file CarlaWheeledVehicle.cpp.

References FoliageBoundingBox, and GetDetectionBox().

Referenced by GetDetectionBox().

◆ GetDetectionSize()

float ACarlaWheeledVehicle::GetDetectionSize ( ) const

◆ GetDrawnWheelPose()

FWheelAnimationData ACarlaWheeledVehicle::GetDrawnWheelPose ( int32  WheelIndex) const

Wheel pose the animation instance drew this frame (else GetWheelPose); what secondaries must draw.

Definition at line 1385 of file CarlaWheeledVehicle.cpp.

References GetWheelPose().

Referenced by FFrameData::AddVehicleParts().

◆ GetFailureState()

carla::rpc::VehicleFailureState ACarlaWheeledVehicle::GetFailureState ( ) const

Definition at line 1855 of file CarlaWheeledVehicle.cpp.

References FailureState.

◆ GetFoliageInstancesCloseToVehicle()

const TArray< int32 > ACarlaWheeledVehicle::GetFoliageInstancesCloseToVehicle ( const UInstancedStaticMeshComponent *  Component) const

◆ GetMaximumSteerAngle()

float ACarlaWheeledVehicle::GetMaximumSteerAngle ( ) const

Get the maximum angle at which the front wheel can steer.

Definition at line 686 of file CarlaWheeledVehicle.cpp.

References GetChaosWheeledVehicleMovementComponent().

Referenced by AWheeledVehicleAIController::OnPossess().

◆ GetMirroredManualGearShift()

bool ACarlaWheeledVehicle::GetMirroredManualGearShift ( ) const
inline

Definition at line 781 of file CarlaWheeledVehicle.h.

◆ GetOpenDoorPoses()

TArray< TPair< int32, FTransform > > ACarlaWheeledVehicle::GetOpenDoorPoses ( ) const

Every door open now (a physics body of its own while open), by door index, with its pose relative to the vehicle.

Definition at line 1753 of file CarlaWheeledVehicle.cpp.

References ConstraintDoor, and ConstraintsComponents.

Referenced by FFrameData::AddVehicleParts().

◆ GetOverriddenWheelPoseOrWarn()

FWheelAnimationData * ACarlaWheeledVehicle::GetOverriddenWheelPoseOrWarn ( EVehicleWheelLocation  WheelLocation,
const TCHAR *  Caller 
)
private

The overridden pose for a setter to write, or nullptr, with a warning, if it cannot be set.

Definition at line 1350 of file CarlaWheeledVehicle.cpp.

References bWheelAnimationOverridden, HasWheelOrWarn(), and OverriddenWheelPoses.

Referenced by SetWheelPitchAngle(), SetWheelSteerDirection(), and SetWheelSuspensionOffset().

◆ GetOverriddenWheelPoses()

const TArray< FWheelAnimationData > & ACarlaWheeledVehicle::GetOverriddenWheelPoses ( ) const
inline

Indexed like the movement component's WheelSetups.

Empty while the wheel animation is not overridden.

Definition at line 711 of file CarlaWheeledVehicle.h.

◆ GetPedalRotation()

float ACarlaWheeledVehicle::GetPedalRotation ( ) const
inline

Two-wheeled vehicles spin a decorative pedal/crank bone (in the vehicle mesh's own Anim Blueprint, unrelated to the rider) via a looping Timeline whose curve doesn't start and end at the same value – every loop the Timeline restarts, the bone's rotation pops instantly back to the curve's start value instead of continuing smoothly, and the rider's foot IK (which targets a socket on that bone) pops along with it.

Play Rate scales with vehicle speed, so the pops get more frequent the faster the vehicle goes, and their size is capped at the curve's fixed peak value – both are the exact symptoms reported ("teleports", "there's a cap"). GetPedalRotation() replaces that Timeline: an angle continuously accumulated from real vehicle speed and wrapped with Fmod, which never pops (359.9 degrees to 0.1 degrees is the same rotation, not a discontinuity) the way a Timeline restarting to an unrelated value does. Bind it directly to whatever currently reads the Timeline's output (Engine Speed -> Pedal Y) in the vehicle Blueprint's Anim Blueprint instead.

Definition at line 424 of file CarlaWheeledVehicle.h.

◆ GetPhysicsConstraintAngle()

FRotator ACarlaWheeledVehicle::GetPhysicsConstraintAngle ( UPhysicsConstraintComponent *  Component)
static

Definition at line 1889 of file CarlaWheeledVehicle.cpp.

◆ GetRotationAnim()

float ACarlaWheeledVehicle::GetRotationAnim ( ) const
inline

Definition at line 925 of file CarlaWheeledVehicle.h.

◆ GetSimulatedWheel()

const UChaosVehicleWheel * ACarlaWheeledVehicle::GetSimulatedWheel ( int32  WheelIndex) const
private

The Chaos wheel, while Chaos simulates the vehicle and has output for it.

Definition at line 1520 of file CarlaWheeledVehicle.cpp.

References GetChaosWheeledVehicleMovementComponent(), and IsSimulatedByChaos().

Referenced by GetWheelPose().

◆ GetSpeedAnim()

float ACarlaWheeledVehicle::GetSpeedAnim ( ) const
inline

Definition at line 919 of file CarlaWheeledVehicle.h.

◆ GetVehicleAckermannControl()

const FVehicleAckermannControl & ACarlaWheeledVehicle::GetVehicleAckermannControl ( ) const
inline

Vehicle Ackermann control currently applied to this vehicle.

Definition at line 121 of file CarlaWheeledVehicle.h.

◆ GetVehicleBoundingBox()

UBoxComponent * ACarlaWheeledVehicle::GetVehicleBoundingBox ( ) const
inline

Get vehicle's bounding box component.

Definition at line 156 of file CarlaWheeledVehicle.h.

◆ GetVehicleBoundingBoxExtent()

FVector ACarlaWheeledVehicle::GetVehicleBoundingBoxExtent ( ) const

Extent of the vehicle's bounding box.

Definition at line 681 of file CarlaWheeledVehicle.cpp.

References VehicleBounds.

◆ GetVehicleBoundingBoxTransform()

FTransform ACarlaWheeledVehicle::GetVehicleBoundingBoxTransform ( ) const

Transform of the vehicle's bounding box relative to the vehicle.

Definition at line 676 of file CarlaWheeledVehicle.cpp.

References VehicleBounds.

◆ GetVehicleControl()

const FVehicleControl & ACarlaWheeledVehicle::GetVehicleControl ( ) const
inline

Vehicle control currently applied to this vehicle.

Definition at line 114 of file CarlaWheeledVehicle.h.

Referenced by FFrameData::AddVehicleParts(), and UDefaultMovementComponent::ProcessControl().

◆ GetVehicleCurrentGear()

int32 ACarlaWheeledVehicle::GetVehicleCurrentGear ( ) const

◆ GetVehicleForwardSpeed()

float ACarlaWheeledVehicle::GetVehicleForwardSpeed ( ) const

◆ GetVehicleLightState()

FVehicleLightState ACarlaWheeledVehicle::GetVehicleLightState ( ) const

Definition at line 934 of file CarlaWheeledVehicle.cpp.

References InputControl.

Referenced by CaService::AddLowFrequencyContainer().

◆ GetVehicleOrientation()

FVector ACarlaWheeledVehicle::GetVehicleOrientation ( ) const

Orientation vector of the vehicle, pointing forward.

Definition at line 655 of file CarlaWheeledVehicle.cpp.

References GetVehicleTransform().

Referenced by CaService::CheckHeadingDelta().

◆ GetVehiclePhysicsControl()

FVehiclePhysicsControl ACarlaWheeledVehicle::GetVehiclePhysicsControl ( ) const

◆ GetVehicleTelemetryData()

FVehicleTelemetryData ACarlaWheeledVehicle::GetVehicleTelemetryData ( ) const

Returns a snapshot of the vehicle's runtime telemetry: forward speed, last applied control inputs, engine RPM, current gear, and per-wheel lateral slip, longitudinal slip, and angular velocity sourced from the Chaos vehicle physics state.

Definition at line 1149 of file CarlaWheeledVehicle.cpp.

References FVehicleControl::Brake, GetChaosWheeledVehicleMovementComponent(), GetVehicleCurrentGear(), GetVehicleForwardSpeed(), LastAppliedControl, FWheelTelemetryData::LatSlip, FVehicleControl::Steer, and FVehicleControl::Throttle.

◆ GetVehicleTransform()

FTransform ACarlaWheeledVehicle::GetVehicleTransform ( ) const
inline

Transform of the vehicle.

Location is shifted so it matches center of the vehicle bounds rather than the actor's location.

Definition at line 129 of file CarlaWheeledVehicle.h.

Referenced by ApplyRolloverBehavior(), and GetVehicleOrientation().

◆ GetVelocity()

FVector ACarlaWheeledVehicle::GetVelocity ( ) const
overridevirtual

◆ GetWheelDefaults()

const UChaosVehicleWheel * ACarlaWheeledVehicle::GetWheelDefaults ( int32  WheelIndex) const
private

◆ GetWheelPitchAngle()

float ACarlaWheeledVehicle::GetWheelPitchAngle ( EVehicleWheelLocation  WheelLocation)

◆ GetWheelPose()

FWheelAnimationData ACarlaWheeledVehicle::GetWheelPose ( int32  WheelIndex) const
private

The pose shown for a wheel: the overridden one, otherwise Chaos's, otherwise the one last drawn.

Definition at line 1369 of file CarlaWheeledVehicle.cpp.

References bWheelAnimationOverridden, GetShownWheelPose(), GetSimulatedWheel(), GetWheelSuspensionAxis(), and OverriddenWheelPoses.

Referenced by GetDrawnWheelPose(), GetWheelPitchAngle(), GetWheelPoses(), GetWheelSteerAngle(), and GetWheelSuspensionOffset().

◆ GetWheelPoses()

TArray< FWheelAnimationData > ACarlaWheeledVehicle::GetWheelPoses ( ) const
private

GetWheelPose for every wheel.

Definition at line 1395 of file CarlaWheeledVehicle.cpp.

References GetWheelPose(), and HasWheel().

Referenced by SetSimulatePhysics(), and SetWheelAnimationOverride().

◆ GetWheelRadius()

float ACarlaWheeledVehicle::GetWheelRadius ( int32  WheelIndex) const

Radius of the wheel at WheelIndex, in cm, as last applied through the physics control.

Does not need the Chaos wheel instances to exist.

Definition at line 1547 of file CarlaWheeledVehicle.cpp.

References GetWheelDefaults(), LastPhysicsControl, and FVehiclePhysicsControl::Wheels.

Referenced by CarlaReplayerHelper::ProcessReplayerAnimVehicleWheels(), and SeedChaosWheels().

◆ GetWheelsFrictionScale()

TArray< float > ACarlaWheeledVehicle::GetWheelsFrictionScale ( )

◆ GetWheelSteerAngle()

float ACarlaWheeledVehicle::GetWheelSteerAngle ( EVehicleWheelLocation  WheelLocation)

◆ GetWheelSuspensionAxis()

FVector ACarlaWheeledVehicle::GetWheelSuspensionAxis ( int32  WheelIndex) const

Unit vector, component space, along which the wheel's suspension drops.

Definition at line 1557 of file CarlaWheeledVehicle.cpp.

References GetWheelDefaults(), LastPhysicsControl, and FVehiclePhysicsControl::Wheels.

Referenced by FFrameData::AddVehicleParts(), GetWheelPose(), GetWheelSuspensionOffset(), SeedChaosWheels(), and SetWheelSuspensionOffset().

◆ GetWheelSuspensionOffset()

float ACarlaWheeledVehicle::GetWheelSuspensionOffset ( EVehicleWheelLocation  WheelLocation)

◆ GetWorldTransformedPose()

FPoseSnapshot ACarlaWheeledVehicle::GetWorldTransformedPose ( )

Definition at line 1901 of file CarlaWheeledVehicle.cpp.

References MakePoseWorldSpace(), and WorldTransformedPose.

◆ HasCarlaVehicleAnimation()

bool ACarlaWheeledVehicle::HasCarlaVehicleAnimation ( ) const

Whether the animation blueprint derives from UCarlaVehicleAnimationInstance, which is what draws the overridden wheel poses.

Definition at line 1515 of file CarlaWheeledVehicle.cpp.

Referenced by CarlaReplayerHelper::ProcessReplayerAnimVehicleWheels(), and SetWheelAnimationOverride().

◆ HasMirroredMotion()

bool ACarlaWheeledVehicle::HasMirroredMotion ( ) const
inline

Definition at line 765 of file CarlaWheeledVehicle.h.

◆ HasWheel()

bool ACarlaWheeledVehicle::HasWheel ( int32  WheelIndex) const

◆ HasWheelOrWarn()

bool ACarlaWheeledVehicle::HasWheelOrWarn ( int32  WheelIndex,
const TCHAR *  Caller 
) const
private

◆ HoldHandbrake()

void ACarlaWheeledVehicle::HoldHandbrake ( )
inline

Definition at line 505 of file CarlaWheeledVehicle.h.

◆ IsAckermannControlActive()

bool ACarlaWheeledVehicle::IsAckermannControlActive ( ) const
inline

Definition at line 450 of file CarlaWheeledVehicle.h.

◆ IsInVehicleRange()

bool ACarlaWheeledVehicle::IsInVehicleRange ( const FVector &  Location) const

Definition at line 569 of file CarlaWheeledVehicle.cpp.

References FoliageBoundingBox, and IsInVehicleRange().

Referenced by IsInVehicleRange().

◆ IsMirroredSimulatingPhysics()

bool ACarlaWheeledVehicle::IsMirroredSimulatingPhysics ( ) const
inline

Definition at line 786 of file CarlaWheeledVehicle.h.

◆ IsSimulatedByChaos()

bool ACarlaWheeledVehicle::IsSimulatedByChaos ( ) const

Whether the Chaos vehicle simulation is moving this vehicle.

Definition at line 1541 of file CarlaWheeledVehicle.cpp.

References BaseMovementComponent, and bPhysicsEnabled.

Referenced by GetSimulatedWheel(), and SetWheelAnimationOverride().

◆ IsTwoWheeledVehicle()

bool ACarlaWheeledVehicle::IsTwoWheeledVehicle ( )

◆ IsTwoWheeledVehicle_Implementation()

virtual bool ACarlaWheeledVehicle::IsTwoWheeledVehicle_Implementation ( )
inlinevirtual

Definition at line 224 of file CarlaWheeledVehicle.h.

◆ IsWheelAnimationOverridden()

bool ACarlaWheeledVehicle::IsWheelAnimationOverridden ( ) const
inline

Definition at line 707 of file CarlaWheeledVehicle.h.

◆ OnRiderBoneTransformsFinalized()

void ACarlaWheeledVehicle::OnRiderBoneTransformsFinalized ( )
private

◆ OnSeedPostTick()

void ACarlaWheeledVehicle::OnSeedPostTick ( FChaosScene *  Scene)
private

◆ OnSeedPreTick()

void ACarlaWheeledVehicle::OnSeedPreTick ( FPhysScene_Chaos *  Scene,
float  DeltaSeconds 
)
private

Definition at line 1468 of file CarlaWheeledVehicle.cpp.

References bSeedStepStarted.

Referenced by ArmSeedRewrite().

◆ OpenDoor()

void ACarlaWheeledVehicle::OpenDoor ( const EVehicleDoor  DoorIdx)

Definition at line 1665 of file CarlaWheeledVehicle.cpp.

References All, ConstraintsComponents, and OpenDoorPhys().

◆ OpenDoorPhys()

void ACarlaWheeledVehicle::OpenDoorPhys ( const EVehicleDoor  DoorIdx)

◆ PrintROS2Message()

void ACarlaWheeledVehicle::PrintROS2Message ( const char *  Message)

Definition at line 59 of file CarlaWheeledVehicle.cpp.

◆ RecordDoorChange()

void ACarlaWheeledVehicle::RecordDoorChange ( const EVehicleDoor  DoorIdx,
const bool  bIsOpen 
)

Definition at line 1803 of file CarlaWheeledVehicle.cpp.

References UCarlaStatics::GetRecorder().

Referenced by CloseDoorPhys(), and OpenDoorPhys().

◆ RefreshLightState()

void ACarlaWheeledVehicle::RefreshLightState ( const FVehicleLightState &  VehicleLightState)
protected

Referenced by SetVehicleLightState().

◆ ReleaseHandbrake()

void ACarlaWheeledVehicle::ReleaseHandbrake ( )
inline

Definition at line 511 of file CarlaWheeledVehicle.h.

◆ RemoveReferenceToManager()

void ACarlaWheeledVehicle::RemoveReferenceToManager ( )
private

Definition at line 1874 of file CarlaWheeledVehicle.cpp.

References IsValid(), and AVegetationManager::RemoveVehicle().

Referenced by EndPlay().

◆ ResetConstraints()

void ACarlaWheeledVehicle::ResetConstraints ( )
protected

◆ ResolveRiderComponentsIfNeeded()

void ACarlaWheeledVehicle::ResolveRiderComponentsIfNeeded ( )
private

◆ RestoreVehiclePhysicsControl()

void ACarlaWheeledVehicle::RestoreVehiclePhysicsControl ( )

◆ SeedChaosWheels()

void ACarlaWheeledVehicle::SeedChaosWheels ( const TArray< FWheelAnimationData > &  Poses)
private

Sets the Chaos wheels to these poses, so that they do not jump when Chaos takes over the wheels again.

Definition at line 1405 of file CarlaWheeledVehicle.cpp.

References ArmSeedRewrite(), GetChaosWheeledVehicleMovementComponent(), GetWheelRadius(), and GetWheelSuspensionAxis().

Referenced by SetSimulatePhysics(), and SetWheelAnimationOverride().

◆ SetAIVehicleState()

void ACarlaWheeledVehicle::SetAIVehicleState ( ECarlaWheeledVehicleState  InState)
inline
Todo:
This function should be private to AWheeledVehicleAIController.

Definition at line 173 of file CarlaWheeledVehicle.h.

References State.

Referenced by AWheeledVehicleAIController::ConfigureAutopilot().

◆ SetBrakeInput()

void ACarlaWheeledVehicle::SetBrakeInput ( float  Value)

◆ SetCarlaMovementComponent()

void ACarlaWheeledVehicle::SetCarlaMovementComponent ( UBaseCarlaMovementComponent *  MoementComponent)

Definition at line 1257 of file CarlaWheeledVehicle.cpp.

References BaseMovementComponent.

◆ SetCenterOfMass()

void ACarlaWheeledVehicle::SetCenterOfMass ( UChaosWheeledVehicleMovementComponent &  VehicleMovComponent,
const FVehiclePhysicsControl &  PhysicsControl 
)

Definition at line 1077 of file CarlaWheeledVehicle.cpp.

References PhysicsControl.

Referenced by ApplyVehiclePhysicsControl().

◆ SetFailureState()

void ACarlaWheeledVehicle::SetFailureState ( const carla::rpc::VehicleFailureState &  FailureState)

Definition at line 1252 of file CarlaWheeledVehicle.cpp.

References FailureState.

◆ SetHandbrakeInput()

void ACarlaWheeledVehicle::SetHandbrakeInput ( bool  Value)

◆ SetMirroredDoorPoses()

void ACarlaWheeledVehicle::SetMirroredDoorPoses ( const TArray< TPair< int32, FTransform > > &  OpenDoors)

Multi-GPU secondary: shows these doors open, at these poses relative to the vehicle, and every other door closed.

A mirror's doors are posed, never simulated.

Definition at line 1769 of file CarlaWheeledVehicle.cpp.

References ConstraintDoor, ConstraintsComponents, and DoorComponentsTransform.

◆ SetMirroredDrivetrain()

void ACarlaWheeledVehicle::SetMirroredDrivetrain ( int32  Gear,
bool  bManualGearShift,
bool  bSimulatingPhysics 
)
inline

Multi-GPU secondary: the primary's gear, which GetVehicleCurrentGear reports instead of the idle drivetrain's, its manual gear shift, and whether the primary's body simulates physics.

Definition at line 773 of file CarlaWheeledVehicle.h.

◆ SetMirroredMotion()

void ACarlaWheeledVehicle::SetMirroredMotion ( const FVector &  Velocity,
float  ForwardSpeed 
)

Multi-GPU secondary: the primary's motion of the vehicle this one mirrors (world frame, cm/s), which GetVelocity and GetVehicleForwardSpeed report instead of this body's: a mirror never moves on its own.

Definition at line 1643 of file CarlaWheeledVehicle.cpp.

References bHasMirroredMotion, MirroredForwardSpeed, and MirroredVelocity.

◆ SetPhysicsConstraintAngle()

void ACarlaWheeledVehicle::SetPhysicsConstraintAngle ( UPhysicsConstraintComponent *  Component,
const FRotator &  NewAngle 
)
static

Definition at line 1895 of file CarlaWheeledVehicle.cpp.

◆ SetReverse()

void ACarlaWheeledVehicle::SetReverse ( bool  Value)

◆ SetRolloverFlag()

void ACarlaWheeledVehicle::SetRolloverFlag ( )

◆ SetRotationAnim()

void ACarlaWheeledVehicle::SetRotationAnim ( float  Rotation)
inline

◆ SetSimulatePhysics()

void ACarlaWheeledVehicle::SetSimulatePhysics ( bool  enabled)

◆ SetSpeedAnim()

void ACarlaWheeledVehicle::SetSpeedAnim ( float  Speed)
inline

◆ SetSteeringInput()

void ACarlaWheeledVehicle::SetSteeringInput ( float  Value)

◆ SetThrottleInput()

void ACarlaWheeledVehicle::SetThrottleInput ( float  Value)

◆ SetVehicleLightState()

void ACarlaWheeledVehicle::SetVehicleLightState ( const FVehicleLightState &  LightState)

◆ SetWheelAnimationOverride()

void ACarlaWheeledVehicle::SetWheelAnimationOverride ( bool  bEnabled)

While the wheel animation is overridden the wheels show only the values set through the wheel setters, whether or not Chaos simulates the vehicle.

Definition at line 1325 of file CarlaWheeledVehicle.cpp.

References bWheelAnimationOverridden, GetWheelPoses(), HasCarlaVehicleAnimation(), IsSimulatedByChaos(), OverriddenWheelPoses, and SeedChaosWheels().

Referenced by CarlaReplayerHelper::ProcessReplayerAnimVehicleWheels().

◆ SetWheelPitchAngle()

void ACarlaWheeledVehicle::SetWheelPitchAngle ( EVehicleWheelLocation  WheelLocation,
float  AngleInDeg 
)

Spin angle of a wheel, in degrees. Purely visual, wheel animation override only.

Definition at line 1292 of file CarlaWheeledVehicle.cpp.

References GetOverriddenWheelPoseOrWarn().

Referenced by CarlaReplayerHelper::ProcessReplayerAnimVehicleWheels().

◆ SetWheelsFrictionScale()

void ACarlaWheeledVehicle::SetWheelsFrictionScale ( TArray< float > &  WheelsFrictionScale)

◆ SetWheelSteerDirection()

void ACarlaWheeledVehicle::SetWheelSteerDirection ( EVehicleWheelLocation  WheelLocation,
float  AngleInDeg 
)

Set the rotation of the car wheels indicated by the user 0 = FL_VehicleWheel, 1 = FR_VehicleWheel, 2 = BL_VehicleWheel, 3 = BR_VehicleWheel NOTE : This is purely aesthetic.

It will not modify the physics of the car in any way

Definition at line 1275 of file CarlaWheeledVehicle.cpp.

References GetOverriddenWheelPoseOrWarn().

Referenced by CarlaReplayerHelper::ProcessReplayerAnimVehicleWheels().

◆ SetWheelSuspensionOffset()

void ACarlaWheeledVehicle::SetWheelSuspensionOffset ( EVehicleWheelLocation  WheelLocation,
float  OffsetInCm 
)

Suspension compression of a wheel, in cm.

Purely visual, wheel animation override only.

Definition at line 1306 of file CarlaWheeledVehicle.cpp.

References GetOverriddenWheelPoseOrWarn(), and GetWheelSuspensionAxis().

◆ ShowDebugTelemetry()

void ACarlaWheeledVehicle::ShowDebugTelemetry ( bool  Enabled)

◆ TickActor()

void ACarlaWheeledVehicle::TickActor ( float  DeltaTime,
enum ELevelTick  TickType,
FActorTickFunction &  ThisTickFunction 
)
overrideprotectedvirtual

◆ ToggleReverse()

void ACarlaWheeledVehicle::ToggleReverse ( )
inline

Definition at line 496 of file CarlaWheeledVehicle.h.

◆ UpdateDetectionBox()

void ACarlaWheeledVehicle::UpdateDetectionBox ( )

Definition at line 576 of file CarlaWheeledVehicle.cpp.

References DetectionSize, and FoliageBoundingBox.

Referenced by AVegetationManager::Tick().

Member Data Documentation

◆ AccelerationControl

TObjectPtr<UVehicleAccelerationControl> ACarlaWheeledVehicle::AccelerationControl
private

◆ AckermannController

FAckermannController ACarlaWheeledVehicle::AckermannController
private

◆ bAckermannControlActive

bool ACarlaWheeledVehicle::bAckermannControlActive = false
private

◆ BaseMovementComponent

UBaseCarlaMovementComponent* ACarlaWheeledVehicle::BaseMovementComponent = nullptr
private

◆ bHasMirroredGear

bool ACarlaWheeledVehicle::bHasMirroredGear = false
private

Definition at line 820 of file CarlaWheeledVehicle.h.

Referenced by FlushVehicleControl(), and GetVehicleCurrentGear().

◆ bHasMirroredMotion

bool ACarlaWheeledVehicle::bHasMirroredMotion = false
private

◆ bHasSavedVehicleLightDefault

bool ACarlaWheeledVehicle::bHasSavedVehicleLightDefault = false
private

◆ bIsNWVehicle

bool ACarlaWheeledVehicle::bIsNWVehicle = false

◆ bMirroredManualGearShift

bool ACarlaWheeledVehicle::bMirroredManualGearShift = false
private

Definition at line 824 of file CarlaWheeledVehicle.h.

◆ bMirroredSimulatingPhysics

bool ACarlaWheeledVehicle::bMirroredSimulatingPhysics = false
private

Definition at line 826 of file CarlaWheeledVehicle.h.

◆ bPhysicsEnabled

bool ACarlaWheeledVehicle::bPhysicsEnabled = true
private

Definition at line 829 of file CarlaWheeledVehicle.h.

Referenced by IsSimulatedByChaos(), and SetSimulatePhysics().

◆ bRiderComponentsResolved

bool ACarlaWheeledVehicle::bRiderComponentsResolved = false
private

Definition at line 614 of file CarlaWheeledVehicle.h.

Referenced by ResolveRiderComponentsIfNeeded().

◆ bSeedStepStarted

bool ACarlaWheeledVehicle::bSeedStepStarted = false
private

Definition at line 875 of file CarlaWheeledVehicle.h.

Referenced by ArmSeedRewrite(), OnSeedPostTick(), and OnSeedPreTick().

◆ bSmoothedVehicleMeshTransformInitialized

bool ACarlaWheeledVehicle::bSmoothedVehicleMeshTransformInitialized = false
private

Definition at line 640 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ bWheelAnimationOverridden

bool ACarlaWheeledVehicle::bWheelAnimationOverridden = false
private

◆ CachedVehicleMeshTransform

FTransform ACarlaWheeledVehicle::CachedVehicleMeshTransform
private

Definition at line 631 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ CachedVehicleSocketTransforms

TMap<FName, FTransform> ACarlaWheeledVehicle::CachedVehicleSocketTransforms
private

Definition at line 630 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ CachedVehicleTransformsTimeSeconds

float ACarlaWheeledVehicle::CachedVehicleTransformsTimeSeconds = 0.0f
private

Definition at line 634 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ CachedVehicleWorldAngularVelocityDegrees

FVector ACarlaWheeledVehicle::CachedVehicleWorldAngularVelocityDegrees = FVector::ZeroVector
private

Definition at line 633 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ CachedVehicleWorldVelocity

FVector ACarlaWheeledVehicle::CachedVehicleWorldVelocity = FVector::ZeroVector
private

Definition at line 632 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ CarSimOriginOffset

float ACarlaWheeledVehicle::CarSimOriginOffset = 150.f

Definition at line 796 of file CarlaWheeledVehicle.h.

Referenced by UCarSimManagerComponent::BeginPlay().

◆ CollisionDisableConstraints

TMap<UPrimitiveComponent*, UPhysicsConstraintComponent*> ACarlaWheeledVehicle::CollisionDisableConstraints
private

Definition at line 891 of file CarlaWheeledVehicle.h.

Referenced by BeginPlay(), CloseDoorPhys(), and OpenDoorPhys().

◆ ConstraintComponentNames

TArray<FName> ACarlaWheeledVehicle::ConstraintComponentNames
protected

Definition at line 547 of file CarlaWheeledVehicle.h.

Referenced by BeginPlay().

◆ ConstraintDoor

TMap<UPhysicsConstraintComponent*, UPrimitiveComponent*> ACarlaWheeledVehicle::ConstraintDoor
private

◆ ConstraintsComponents

TArray<UPhysicsConstraintComponent*> ACarlaWheeledVehicle::ConstraintsComponents
private

◆ Control

FVehicleControl ACarlaWheeledVehicle::Control

◆ DetectionSize

float ACarlaWheeledVehicle::DetectionSize { 750.0f }

Definition at line 649 of file CarlaWheeledVehicle.h.

Referenced by GetDetectionSize(), and UpdateDetectionBox().

◆ DoorComponentsTransform

TMap<UPrimitiveComponent*, FTransform> ACarlaWheeledVehicle::DoorComponentsTransform
private

◆ DoorOpenStrength

float ACarlaWheeledVehicle::DoorOpenStrength = 100.0f
protected

Definition at line 550 of file CarlaWheeledVehicle.h.

Referenced by OpenDoorPhys().

◆ FailureState

carla::rpc::VehicleFailureState ACarlaWheeledVehicle::FailureState = carla::rpc::VehicleFailureState::None
private

◆ FoliageBoundingBox

FBox ACarlaWheeledVehicle::FoliageBoundingBox

◆ [struct]

struct { ... } ACarlaWheeledVehicle::InputControl

◆ LastAppliedAckermannControl

FVehicleAckermannControl ACarlaWheeledVehicle::LastAppliedAckermannControl
private

Definition at line 578 of file CarlaWheeledVehicle.h.

Referenced by ApplyVehicleAckermannControl().

◆ LastAppliedControl

FVehicleControl ACarlaWheeledVehicle::LastAppliedControl
private

Definition at line 577 of file CarlaWheeledVehicle.h.

Referenced by FlushVehicleControl(), and GetVehicleTelemetryData().

◆ LastPhysicsControl

FVehiclePhysicsControl ACarlaWheeledVehicle::LastPhysicsControl
private

◆ LightState

FVehicleLightState ACarlaWheeledVehicle::LightState

◆ MirroredForwardSpeed

float ACarlaWheeledVehicle::MirroredForwardSpeed = 0.0f
private

◆ MirroredGear

int32 ACarlaWheeledVehicle::MirroredGear = 0
private

Definition at line 822 of file CarlaWheeledVehicle.h.

Referenced by GetVehicleCurrentGear().

◆ MirroredVelocity

FVector ACarlaWheeledVehicle::MirroredVelocity = FVector::ZeroVector
private

Definition at line 816 of file CarlaWheeledVehicle.h.

Referenced by ClearMirroredMotion(), GetVelocity(), and SetMirroredMotion().

◆ OverriddenWheelPoses

TArray<FWheelAnimationData> ACarlaWheeledVehicle::OverriddenWheelPoses
private

◆ PedalRotationAngle

float ACarlaWheeledVehicle::PedalRotationAngle = 0.0f
private

Definition at line 645 of file CarlaWheeledVehicle.h.

Referenced by TickActor().

◆ PedalRotationDegreesPerCm

float ACarlaWheeledVehicle::PedalRotationDegreesPerCm = 0.5f

Degrees the pedal bone rotates per centimeter of real vehicle travel (see GetPedalRotation).

Tune in-editor to match the desired pedaling cadence – no recompile needed.

Definition at line 433 of file CarlaWheeledVehicle.h.

Referenced by TickActor().

◆ PendingSeedSpins

TArray<float> ACarlaWheeledVehicle::PendingSeedSpins
private

Degrees, as drawn.

Definition at line 873 of file CarlaWheeledVehicle.h.

Referenced by ArmSeedRewrite(), DisarmSeedRewrite(), and OnSeedPostTick().

◆ Priority

EVehicleInputPriority ACarlaWheeledVehicle::Priority = EVehicleInputPriority::INVALID

Definition at line 558 of file CarlaWheeledVehicle.h.

Referenced by ApplyVehicleControl().

◆ RiderMeshComponent

TObjectPtr<USkeletalMeshComponent> ACarlaWheeledVehicle::RiderMeshComponent = nullptr
private

◆ RiderMeshComponentName

FName ACarlaWheeledVehicle::RiderMeshComponentName = TEXT("SkeletalMesh")

Two-wheeled vehicles (bikes/motorcycles) embed their rider as a SkeletalMeshComponent (named RiderMeshComponentName) meant to sit on VehicleMeshSeatSocketName.

That positioning is still driven by Blueprint graph logic left over from the UE4-to-UE5 port, and it drifts the rider backward off the seat while the vehicle is moving. Rather than rewrite that graph, OnRiderBoneTransformsFinalized (see below) snaps the rider back onto the seat socket every frame, after this component's animation has finished evaluating for that frame – nothing runs afterwards that could undo it before render, regardless of what the Blueprint graph or its animation does. Only takes effect when IsTwoWheeledVehicle() is true and both component names resolve to real components on this actor.

This does not fully fix the drift by itself – the rider's own Anim Blueprint separately queries this same seat socket in its own Event BlueprintUpdateAnimation, and that read intermittently races ahead of the vehicle mesh's physics update for the frame (confirmed by logging both reads: on the frames it happens, the Blueprint's read exactly matches the PREVIOUS frame's real seat transform – a one-frame-stale read on some frames but not others, which looks like a pop, not a continuous drift). See GetCachedVehicleSocketWorldTransform() below, which the Blueprint should read instead of querying the socket itself – for this one and every other vehicle-mesh socket its Data Gather reads.

Definition at line 253 of file CarlaWheeledVehicle.h.

Referenced by ResolveRiderComponentsIfNeeded().

◆ RiderSeatRelativeRotationOffset

FRotator ACarlaWheeledVehicle::RiderSeatRelativeRotationOffset = FRotator(0.0f, -90.0f, 15.0f)

The rider mesh's rest pose isn't authored to sit flush with the socket's own local axes – its component template ships with this exact relative rotation baked in (no translation), so the seat-lock composes it on top of the socket's world transform instead of using the bare socket transform, which twisted the pose.

Definition at line 404 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ RiderSeatSmoothingSpeed

float ACarlaWheeledVehicle::RiderSeatSmoothingSpeed = 10.0f

Chaos suspension has small, real, high-frequency vertical jitter on the vehicle mesh every frame (visible as the rider's torso/hip bouncing, the seat popping the rider up) – physically real, not a bug, but the seat-lock's hard snap transmits it 1:1 to the rider with zero smoothing.

This is the speed (see FMath::FInterpTo) used to low-pass just the VERTICAL (Z) component of the cached base transform that GetCachedVehicleSocketWorldTransform() extrapolates from – purely cosmetic, applied only to what the rider reads, never to the vehicle's actual physics transform. X/Y and rotation are never smoothed (see OnRiderBoneTransformsFinalized's comment – smoothing those trails a moving target by more the faster the vehicle goes, which looked exactly like the original slide bug). Higher = snappier (less smoothing); lower = smoother but more vertical lag.

Definition at line 272 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ RolloverBehaviorForce

float ACarlaWheeledVehicle::RolloverBehaviorForce = 0.35
private

Definition at line 588 of file CarlaWheeledVehicle.h.

Referenced by CheckRollover().

◆ RolloverBehaviorTracker

int ACarlaWheeledVehicle::RolloverBehaviorTracker = 0
private

Definition at line 589 of file CarlaWheeledVehicle.h.

Referenced by ApplyRolloverBehavior(), CheckRollover(), and SetRolloverFlag().

◆ RolloverFlagTime

float ACarlaWheeledVehicle::RolloverFlagTime = 5.0f
private

Definition at line 590 of file CarlaWheeledVehicle.h.

Referenced by ApplyRolloverBehavior().

◆ RotationAnim

float ACarlaWheeledVehicle::RotationAnim { 0.0f }

Definition at line 915 of file CarlaWheeledVehicle.h.

◆ SavedVehicleLightGroupIntensity

TMap<FString, float> ACarlaWheeledVehicle::SavedVehicleLightGroupIntensity
private

◆ SavedVehicleLightIntensity

float ACarlaWheeledVehicle::SavedVehicleLightIntensity = 1.0f
private

◆ SeedPostTickHandle

FDelegateHandle ACarlaWheeledVehicle::SeedPostTickHandle
private

Definition at line 879 of file CarlaWheeledVehicle.h.

Referenced by ArmSeedRewrite(), and DisarmSeedRewrite().

◆ SeedPreTickHandle

FDelegateHandle ACarlaWheeledVehicle::SeedPreTickHandle
private

Definition at line 877 of file CarlaWheeledVehicle.h.

Referenced by ArmSeedRewrite(), and DisarmSeedRewrite().

◆ SmoothedVehicleMeshTransform

FTransform ACarlaWheeledVehicle::SmoothedVehicleMeshTransform
private

Definition at line 639 of file CarlaWheeledVehicle.h.

Referenced by OnRiderBoneTransformsFinalized().

◆ SpeedAnim

float ACarlaWheeledVehicle::SpeedAnim { 0.0f }

Definition at line 914 of file CarlaWheeledVehicle.h.

◆ State

ECarlaWheeledVehicleState ACarlaWheeledVehicle::State = ECarlaWheeledVehicleState::UNKNOWN
private

Current state of the vehicle controller (for debugging purposes).

Definition at line 568 of file CarlaWheeledVehicle.h.

◆ TimerHandler

FTimerHandle ACarlaWheeledVehicle::TimerHandler
private

Definition at line 912 of file CarlaWheeledVehicle.h.

Referenced by ApplyRolloverBehavior().

◆ VehicleBounds

TObjectPtr<UBoxComponent> ACarlaWheeledVehicle::VehicleBounds

◆ VehicleMeshForRiderSeat

TObjectPtr<USkeletalMeshComponent> ACarlaWheeledVehicle::VehicleMeshForRiderSeat = nullptr
private

◆ VehicleMeshSeatSocketName

FName ACarlaWheeledVehicle::VehicleMeshSeatSocketName = TEXT("Seat")

◆ VelocityControl

TObjectPtr<UVehicleVelocityControl> ACarlaWheeledVehicle::VelocityControl
private

◆ WorldTransformedPose

FPoseSnapshot ACarlaWheeledVehicle::WorldTransformedPose

Definition at line 916 of file CarlaWheeledVehicle.h.

Referenced by GetWorldTransformedPose(), and TickActor().


The documentation for this class was generated from the following files: