|
CARLA
|
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) | |
Base class for CARLA wheeled vehicles.
Definition at line 84 of file CarlaWheeledVehicle.h.
| ACarlaWheeledVehicle::ACarlaWheeledVehicle | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 65 of file CarlaWheeledVehicle.cpp.
References AccelerationControl, BaseMovementComponent, GetChaosWheeledVehicleMovementComponent(), VehicleBounds, and VelocityControl.
| ACarlaWheeledVehicle::~ACarlaWheeledVehicle | ( | ) |
Definition at line 85 of file CarlaWheeledVehicle.cpp.
| void ACarlaWheeledVehicle::ActivateAccelerationControl | ( | const FVector & | Acceleration | ) |
Definition at line 1122 of file CarlaWheeledVehicle.cpp.
References AccelerationControl.
|
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().
| void ACarlaWheeledVehicle::ActivateVelocityControl | ( | const FVector & | Velocity | ) |
Definition at line 1112 of file CarlaWheeledVehicle.cpp.
References VelocityControl.
|
private |
Definition at line 1859 of file CarlaWheeledVehicle.cpp.
References AVegetationManager::AddVehicle(), and IsValid().
Referenced by BeginPlay().
|
protected |
Definition at line 621 of file CarlaWheeledVehicle.cpp.
References BoundingBox, UBoundingBoxCalculator::GetVehicleBoundingBox(), and VehicleBounds.
|
inline |
Definition at line 211 of file CarlaWheeledVehicle.h.
|
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.
| 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.
| void ACarlaWheeledVehicle::ApplyVehicleAckermannControl | ( | const FVehicleAckermannControl & | AckermannControl, |
| EVehicleInputPriority | Priority | ||
| ) |
Definition at line 1105 of file CarlaWheeledVehicle.cpp.
References AckermannController, bAckermannControlActive, LastAppliedAckermannControl, and FAckermannController::SetTargetPoint().
| void ACarlaWheeledVehicle::ApplyVehicleControl | ( | const FVehicleControl & | Control, |
| EVehicleInputPriority | Priority | ||
| ) |
Definition at line 1091 of file CarlaWheeledVehicle.cpp.
References AckermannController, bAckermannControlActive, Control, InputControl, Priority, and FAckermannController::Reset().
Referenced by SetBrakeInput(), SetHandbrakeInput(), SetReverse(), SetSteeringInput(), SetThrottleInput(), and AWheeledVehicleAIController::Tick().
|
private |
Definition at line 276 of file CarlaWheeledVehicle.cpp.
References ULightDefaultsJsonUtils::ApplyVehicleLightsRuntimeState(), bHasSavedVehicleLightDefault, FVehicleLightState::Brake, FVehicleLightState::Fog, FVehicleLightState::HighBeam, InputControl, FVehicleLightState::Interior, FVehicleLightState::LeftBlinker, LightState, FVehicleLightState::LowBeam, FVehicleLightState::Position, FVehicleLightState::Reverse, FVehicleLightState::RightBlinker, SavedVehicleLightGroupIntensity, SavedVehicleLightIntensity, and FVehicleLightState::Special1.
Referenced by ActivateVehicleLightComponents(), and SetVehicleLightState().
| void ACarlaWheeledVehicle::ApplyVehiclePhysicsControl | ( | const FVehiclePhysicsControl & | PhysicsControl | ) |
Definition at line 944 of file CarlaWheeledVehicle.cpp.
References AckermannController, ApplyWheelPhysicsControl(), GetChaosWheeledVehicleMovementComponent(), UCarlaStatics::GetRecorder(), LastPhysicsControl, PhysicsControl, ResetConstraints(), SetCenterOfMass(), and FAckermannController::UpdateVehiclePhysics().
Referenced by RestoreVehiclePhysicsControl().
|
private |
Applies LastPhysicsControl.Wheels to the live Chaos wheels.
Call it after every RecreatePhysicsState(), which resets them to the class defaults.
Definition at line 999 of file CarlaWheeledVehicle.cpp.
References FWheelPhysicsControl::bABSEnabled, FWheelPhysicsControl::bAffectedByBrake, FWheelPhysicsControl::bAffectedByEngine, FWheelPhysicsControl::bAffectedByHandbrake, FWheelPhysicsControl::bAffectedBySteering, FWheelPhysicsControl::bTractionControlEnabled, FWheelPhysicsControl::ExternalTorqueCombineMethod, FWheelPhysicsControl::FrictionForceMultiplier, GetChaosWheeledVehicleMovementComponent(), LastPhysicsControl, FWheelPhysicsControl::MaxBrakeTorque, FWheelPhysicsControl::MaxHandBrakeTorque, FWheelPhysicsControl::MaxSteerAngle, FWheelPhysicsControl::SweepType, FVehiclePhysicsControl::UseSweepWheelCollision, FWheelPhysicsControl::WheelRadius, and FVehiclePhysicsControl::Wheels.
Referenced by ApplyVehiclePhysicsControl(), and SetSimulatePhysics().
|
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().
|
overrideprotectedvirtual |
Definition at line 87 of file CarlaWheeledVehicle.cpp.
References AckermannController, ActivateVehicleLightComponents(), AddReferenceToManager(), CollisionDisableConstraints, ConstraintComponentNames, ConstraintDoor, ConstraintsComponents, UDefaultMovementComponent::CreateDefaultMovementComponent(), DoorComponentsTransform, GetChaosWheeledVehicleMovementComponent(), GetVehiclePhysicsControl(), LastPhysicsControl, ResetConstraints(), and FAckermannController::UpdateVehiclePhysics().
|
private |
Definition at line 1839 of file CarlaWheeledVehicle.cpp.
References RolloverBehaviorForce, and RolloverBehaviorTracker.
Referenced by ApplyRolloverBehavior().
| void ACarlaWheeledVehicle::ClearMirroredMotion | ( | ) |
Definition at line 1650 of file CarlaWheeledVehicle.cpp.
References bHasMirroredMotion, MirroredForwardSpeed, and MirroredVelocity.
| void ACarlaWheeledVehicle::CloseDoor | ( | const EVehicleDoor | DoorIdx | ) |
Definition at line 1682 of file CarlaWheeledVehicle.cpp.
References All, CloseDoorPhys(), and ConstraintsComponents.
| void ACarlaWheeledVehicle::CloseDoorPhys | ( | const EVehicleDoor | DoorIdx | ) |
Definition at line 1732 of file CarlaWheeledVehicle.cpp.
References CollisionDisableConstraints, ConstraintDoor, ConstraintsComponents, DoorComponentsTransform, and RecordDoorChange().
Referenced by CloseDoor(), and ResetConstraints().
| void ACarlaWheeledVehicle::DeactivateAccelerationControl | ( | ) |
Definition at line 1127 of file CarlaWheeledVehicle.cpp.
References AccelerationControl.
| void ACarlaWheeledVehicle::DeactivateVelocityControl | ( | ) |
Definition at line 1117 of file CarlaWheeledVehicle.cpp.
References VelocityControl.
|
private |
Definition at line 1455 of file CarlaWheeledVehicle.cpp.
References PendingSeedSpins, SeedPostTickHandle, and SeedPreTickHandle.
Referenced by ArmSeedRewrite(), EndPlay(), and OnSeedPostTick().
| void ACarlaWheeledVehicle::DrawFoliageBoundingBox | ( | ) | const |
Definition at line 602 of file CarlaWheeledVehicle.cpp.
References FoliageBoundingBox.
|
protectedvirtual |
Definition at line 1657 of file CarlaWheeledVehicle.cpp.
References DisarmSeedRewrite(), and RemoveReferenceToManager().
| void ACarlaWheeledVehicle::FlushVehicleControl | ( | ) |
Definition at line 716 of file CarlaWheeledVehicle.cpp.
References AckermannController, bAckermannControlActive, BaseMovementComponent, bHasMirroredGear, InputControl, INVALID, LastAppliedControl, UBaseCarlaMovementComponent::ProcessControl(), FAckermannController::RunLoop(), and FAckermannController::UpdateVehicleState().
Referenced by AWheeledVehicleAIController::Tick(), and TickActor().
|
inline |
Definition at line 197 of file CarlaWheeledVehicle.h.
|
inline |
Definition at line 179 of file CarlaWheeledVehicle.h.
References State.
| FBoxSphereBounds ACarlaWheeledVehicle::GetBoxSphereBounds | ( | ) | const |
Definition at line 610 of file CarlaWheeledVehicle.cpp.
References UCarlaStatics::GetLargeMapManager(), ALargeMapManager::LocalToGlobalTransform(), and VehicleBounds.
|
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().
|
inline |
Definition at line 523 of file CarlaWheeledVehicle.h.
| FVector ACarlaWheeledVehicle::GetCenterOfMass | ( | UChaosWheeledVehicleMovementComponent & | VehicleMovComponent | ) | const |
Definition at line 920 of file CarlaWheeledVehicle.cpp.
Referenced by GetVehiclePhysicsControl().
|
inline |
Get chaos wheeled vehicle movement component casted.
Definition at line 107 of file CarlaWheeledVehicle.h.
Referenced by ACarlaWheeledVehicle(), FFrameData::AddVehicleParts(), ACarlaRecorder::AddVehicleWheelsAnimation(), ApplyVehiclePhysicsControl(), ApplyWheelPhysicsControl(), BeginPlay(), GetMaximumSteerAngle(), GetSimulatedWheel(), GetVehiclePhysicsControl(), GetVehicleTelemetryData(), GetWheelDefaults(), GetWheelsFrictionScale(), HasWheel(), OnSeedPostTick(), UDefaultMovementComponent::ProcessControl(), SeedChaosWheels(), SetSimulatePhysics(), SetWheelsFrictionScale(), ShowDebugTelemetry(), and TickActor().
| FBox ACarlaWheeledVehicle::GetDetectionBox | ( | ) | const |
Definition at line 591 of file CarlaWheeledVehicle.cpp.
References FoliageBoundingBox, and GetDetectionBox().
Referenced by GetDetectionBox().
| float ACarlaWheeledVehicle::GetDetectionSize | ( | ) | const |
Definition at line 597 of file CarlaWheeledVehicle.cpp.
References DetectionSize.
Referenced by AVegetationManager::DestroySkeletalFoliages(), and AVegetationManager::SpawnSkeletalFoliages().
| 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().
| carla::rpc::VehicleFailureState ACarlaWheeledVehicle::GetFailureState | ( | ) | const |
Definition at line 1855 of file CarlaWheeledVehicle.cpp.
References FailureState.
| const TArray< int32 > ACarlaWheeledVehicle::GetFoliageInstancesCloseToVehicle | ( | const UInstancedStaticMeshComponent * | Component | ) | const |
Definition at line 585 of file CarlaWheeledVehicle.cpp.
References FoliageBoundingBox, and GetFoliageInstancesCloseToVehicle().
Referenced by AVegetationManager::GetElementsToSpawn(), and GetFoliageInstancesCloseToVehicle().
| 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().
|
inline |
Definition at line 781 of file CarlaWheeledVehicle.h.
| 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().
|
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().
|
inline |
Indexed like the movement component's WheelSetups.
Empty while the wheel animation is not overridden.
Definition at line 711 of file CarlaWheeledVehicle.h.
|
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.
|
static |
Definition at line 1889 of file CarlaWheeledVehicle.cpp.
|
inline |
Definition at line 925 of file CarlaWheeledVehicle.h.
|
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().
|
inline |
Definition at line 919 of file CarlaWheeledVehicle.h.
|
inline |
Vehicle Ackermann control currently applied to this vehicle.
Definition at line 121 of file CarlaWheeledVehicle.h.
|
inline |
Get vehicle's bounding box component.
Definition at line 156 of file CarlaWheeledVehicle.h.
| FVector ACarlaWheeledVehicle::GetVehicleBoundingBoxExtent | ( | ) | const |
Extent of the vehicle's bounding box.
Definition at line 681 of file CarlaWheeledVehicle.cpp.
References VehicleBounds.
| 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.
|
inline |
Vehicle control currently applied to this vehicle.
Definition at line 114 of file CarlaWheeledVehicle.h.
Referenced by FFrameData::AddVehicleParts(), and UDefaultMovementComponent::ProcessControl().
| int32 ACarlaWheeledVehicle::GetVehicleCurrentGear | ( | ) | const |
Active gear of the vehicle.
Definition at line 660 of file CarlaWheeledVehicle.cpp.
References AccelerationControl, BaseMovementComponent, bHasMirroredGear, UBaseCarlaMovementComponent::GetVehicleCurrentGear(), and MirroredGear.
Referenced by FFrameData::AddVehicleParts(), and GetVehicleTelemetryData().
| float ACarlaWheeledVehicle::GetVehicleForwardSpeed | ( | ) | const |
Forward speed in cm/s. Might be negative if goes backwards.
Definition at line 646 of file CarlaWheeledVehicle.cpp.
References BaseMovementComponent, bHasMirroredMotion, UBaseCarlaMovementComponent::GetVehicleForwardSpeed(), and MirroredForwardSpeed.
Referenced by CaService::AddBasicVehicleContainerHighFrequency(), CaService::CheckSpeedDelta(), CaService::ComputeSpeed(), GetVehicleTelemetryData(), and TickActor().
| FVehicleLightState ACarlaWheeledVehicle::GetVehicleLightState | ( | ) | const |
Definition at line 934 of file CarlaWheeledVehicle.cpp.
References InputControl.
Referenced by CaService::AddLowFrequencyContainer().
| 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().
| FVehiclePhysicsControl ACarlaWheeledVehicle::GetVehiclePhysicsControl | ( | ) | const |
Definition at line 807 of file CarlaWheeledVehicle.cpp.
References GetCenterOfMass(), GetChaosWheeledVehicleMovementComponent(), and PhysicsControl.
Referenced by BeginPlay().
| 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.
|
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().
|
overridevirtual |
Definition at line 1634 of file CarlaWheeledVehicle.cpp.
References BaseMovementComponent, bHasMirroredMotion, UBaseCarlaMovementComponent::GetVelocity(), and MirroredVelocity.
|
private |
Definition at line 1567 of file CarlaWheeledVehicle.cpp.
References GetChaosWheeledVehicleMovementComponent().
Referenced by GetWheelRadius(), and GetWheelSuspensionAxis().
| float ACarlaWheeledVehicle::GetWheelPitchAngle | ( | EVehicleWheelLocation | WheelLocation | ) |
Definition at line 1300 of file CarlaWheeledVehicle.cpp.
References GetWheelPose(), and HasWheelOrWarn().
Referenced by ACarlaRecorder::AddVehicleWheelsAnimation().
|
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().
|
private |
GetWheelPose for every wheel.
Definition at line 1395 of file CarlaWheeledVehicle.cpp.
References GetWheelPose(), and HasWheel().
Referenced by SetSimulatePhysics(), and SetWheelAnimationOverride().
| 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().
| TArray< float > ACarlaWheeledVehicle::GetWheelsFrictionScale | ( | ) |
Definition at line 770 of file CarlaWheeledVehicle.cpp.
References GetChaosWheeledVehicleMovementComponent().
| float ACarlaWheeledVehicle::GetWheelSteerAngle | ( | EVehicleWheelLocation | WheelLocation | ) |
Definition at line 1283 of file CarlaWheeledVehicle.cpp.
References GetWheelPose(), and HasWheelOrWarn().
Referenced by ACarlaRecorder::AddVehicleWheelsAnimation().
| 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().
| float ACarlaWheeledVehicle::GetWheelSuspensionOffset | ( | EVehicleWheelLocation | WheelLocation | ) |
Definition at line 1315 of file CarlaWheeledVehicle.cpp.
References GetWheelPose(), GetWheelSuspensionAxis(), and HasWheelOrWarn().
| FPoseSnapshot ACarlaWheeledVehicle::GetWorldTransformedPose | ( | ) |
Definition at line 1901 of file CarlaWheeledVehicle.cpp.
References MakePoseWorldSpace(), and WorldTransformedPose.
| 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().
|
inline |
Definition at line 765 of file CarlaWheeledVehicle.h.
| bool ACarlaWheeledVehicle::HasWheel | ( | int32 | WheelIndex | ) | const |
Definition at line 1509 of file CarlaWheeledVehicle.cpp.
References GetChaosWheeledVehicleMovementComponent().
Referenced by FFrameData::AddVehicleParts(), ACarlaRecorder::AddVehicleWheelsAnimation(), GetWheelPoses(), HasWheelOrWarn(), and CarlaReplayerHelper::ProcessReplayerAnimVehicleWheels().
|
private |
Definition at line 1495 of file CarlaWheeledVehicle.cpp.
References HasWheel().
Referenced by GetOverriddenWheelPoseOrWarn(), GetWheelPitchAngle(), GetWheelSteerAngle(), and GetWheelSuspensionOffset().
|
inline |
Definition at line 505 of file CarlaWheeledVehicle.h.
|
inline |
Definition at line 450 of file CarlaWheeledVehicle.h.
| bool ACarlaWheeledVehicle::IsInVehicleRange | ( | const FVector & | Location | ) | const |
Definition at line 569 of file CarlaWheeledVehicle.cpp.
References FoliageBoundingBox, and IsInVehicleRange().
Referenced by IsInVehicleRange().
|
inline |
Definition at line 786 of file CarlaWheeledVehicle.h.
| 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().
| bool ACarlaWheeledVehicle::IsTwoWheeledVehicle | ( | ) |
|
inlinevirtual |
Definition at line 224 of file CarlaWheeledVehicle.h.
|
inline |
Definition at line 707 of file CarlaWheeledVehicle.h.
|
private |
Definition at line 390 of file CarlaWheeledVehicle.cpp.
References bHasMirroredMotion, bSmoothedVehicleMeshTransformInitialized, CachedVehicleMeshTransform, CachedVehicleSocketTransforms, CachedVehicleTransformsTimeSeconds, CachedVehicleWorldAngularVelocityDegrees, CachedVehicleWorldVelocity, CarlaGetActorAngularVelocityInRadians(), GetCachedVehicleSocketWorldTransform(), RiderMeshComponent, RiderSeatRelativeRotationOffset, RiderSeatSmoothingSpeed, SmoothedVehicleMeshTransform, VehicleMeshForRiderSeat, and VehicleMeshSeatSocketName.
Referenced by ResolveRiderComponentsIfNeeded().
|
private |
Definition at line 1474 of file CarlaWheeledVehicle.cpp.
References bSeedStepStarted, DisarmSeedRewrite(), GetChaosWheeledVehicleMovementComponent(), and PendingSeedSpins.
Referenced by ArmSeedRewrite().
|
private |
Definition at line 1468 of file CarlaWheeledVehicle.cpp.
References bSeedStepStarted.
Referenced by ArmSeedRewrite().
| void ACarlaWheeledVehicle::OpenDoor | ( | const EVehicleDoor | DoorIdx | ) |
Definition at line 1665 of file CarlaWheeledVehicle.cpp.
References All, ConstraintsComponents, and OpenDoorPhys().
| void ACarlaWheeledVehicle::OpenDoorPhys | ( | const EVehicleDoor | DoorIdx | ) |
Definition at line 1699 of file CarlaWheeledVehicle.cpp.
References CollisionDisableConstraints, ConstraintDoor, ConstraintsComponents, DoorComponentsTransform, DoorOpenStrength, and RecordDoorChange().
Referenced by OpenDoor(), and ResetConstraints().
| void ACarlaWheeledVehicle::PrintROS2Message | ( | const char * | Message | ) |
Definition at line 59 of file CarlaWheeledVehicle.cpp.
| 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().
|
protected |
Referenced by SetVehicleLightState().
|
inline |
Definition at line 511 of file CarlaWheeledVehicle.h.
|
private |
Definition at line 1874 of file CarlaWheeledVehicle.cpp.
References IsValid(), and AVegetationManager::RemoveVehicle().
Referenced by EndPlay().
|
protected |
Definition at line 1622 of file CarlaWheeledVehicle.cpp.
References CloseDoorPhys(), ConstraintsComponents, and OpenDoorPhys().
Referenced by ApplyVehiclePhysicsControl(), BeginPlay(), and SetSimulatePhysics().
|
private |
Definition at line 324 of file CarlaWheeledVehicle.cpp.
References bRiderComponentsResolved, IsTwoWheeledVehicle(), OnRiderBoneTransformsFinalized(), RiderMeshComponent, RiderMeshComponentName, VehicleMeshForRiderSeat, and VehicleMeshSeatSocketName.
Referenced by TickActor().
| void ACarlaWheeledVehicle::RestoreVehiclePhysicsControl | ( | ) |
Definition at line 939 of file CarlaWheeledVehicle.cpp.
References ApplyVehiclePhysicsControl(), and LastPhysicsControl.
Referenced by UBaseCarlaMovementComponent::EnableUE4VehiclePhysics(), UCarSimManagerComponent::OnCarSimHit(), and UCarSimManagerComponent::OnCarSimOverlap().
|
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().
|
inline |
Definition at line 173 of file CarlaWheeledVehicle.h.
References State.
Referenced by AWheeledVehicleAIController::ConfigureAutopilot().
| void ACarlaWheeledVehicle::SetBrakeInput | ( | float | Value | ) |
Definition at line 749 of file CarlaWheeledVehicle.cpp.
References ApplyVehicleControl(), FVehicleControl::Brake, Control, and InputControl.
Referenced by AWheeledVehicleAIController::ConfigureAutopilot().
| void ACarlaWheeledVehicle::SetCarlaMovementComponent | ( | UBaseCarlaMovementComponent * | MoementComponent | ) |
Definition at line 1257 of file CarlaWheeledVehicle.cpp.
References BaseMovementComponent.
| void ACarlaWheeledVehicle::SetCenterOfMass | ( | UChaosWheeledVehicleMovementComponent & | VehicleMovComponent, |
| const FVehiclePhysicsControl & | PhysicsControl | ||
| ) |
Definition at line 1077 of file CarlaWheeledVehicle.cpp.
References PhysicsControl.
Referenced by ApplyVehiclePhysicsControl().
| void ACarlaWheeledVehicle::SetFailureState | ( | const carla::rpc::VehicleFailureState & | FailureState | ) |
Definition at line 1252 of file CarlaWheeledVehicle.cpp.
References FailureState.
| void ACarlaWheeledVehicle::SetHandbrakeInput | ( | bool | Value | ) |
Definition at line 763 of file CarlaWheeledVehicle.cpp.
References ApplyVehicleControl(), FVehicleControl::bHandBrake, Control, and InputControl.
Referenced by AWheeledVehicleAIController::ConfigureAutopilot().
| 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.
|
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.
| 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.
|
static |
Definition at line 1895 of file CarlaWheeledVehicle.cpp.
| void ACarlaWheeledVehicle::SetReverse | ( | bool | Value | ) |
Definition at line 756 of file CarlaWheeledVehicle.cpp.
References ApplyVehicleControl(), FVehicleControl::bReverse, Control, and InputControl.
Referenced by AWheeledVehicleAIController::ConfigureAutopilot().
| void ACarlaWheeledVehicle::SetRolloverFlag | ( | ) |
Definition at line 1848 of file CarlaWheeledVehicle.cpp.
References FailureState, carla::rpc::Rollover, and RolloverBehaviorTracker.
Referenced by ApplyRolloverBehavior().
|
inline |
Definition at line 928 of file CarlaWheeledVehicle.h.
Referenced by FFrameData::ProcessReplayerAnimBiker(), and CarlaReplayerHelper::ProcessReplayerAnimBiker().
| void ACarlaWheeledVehicle::SetSimulatePhysics | ( | bool | enabled | ) |
Definition at line 1578 of file CarlaWheeledVehicle.cpp.
References ApplyWheelPhysicsControl(), bPhysicsEnabled, GetChaosWheeledVehicleMovementComponent(), GetWheelPoses(), ResetConstraints(), and SeedChaosWheels().
|
inline |
Definition at line 922 of file CarlaWheeledVehicle.h.
Referenced by FFrameData::ProcessReplayerAnimBiker(), and CarlaReplayerHelper::ProcessReplayerAnimBiker().
| void ACarlaWheeledVehicle::SetSteeringInput | ( | float | Value | ) |
Definition at line 742 of file CarlaWheeledVehicle.cpp.
References ApplyVehicleControl(), Control, InputControl, and FVehicleControl::Steer.
Referenced by AWheeledVehicleAIController::ConfigureAutopilot().
| void ACarlaWheeledVehicle::SetThrottleInput | ( | float | Value | ) |
Definition at line 735 of file CarlaWheeledVehicle.cpp.
References ApplyVehicleControl(), Control, InputControl, and FVehicleControl::Throttle.
Referenced by AWheeledVehicleAIController::ConfigureAutopilot().
| void ACarlaWheeledVehicle::SetVehicleLightState | ( | const FVehicleLightState & | LightState | ) |
Definition at line 1225 of file CarlaWheeledVehicle.cpp.
References ApplyVehicleLightDefaultsForCurrentState(), FVehicleLightState::Brake, FVehicleLightState::Fog, FVehicleLightState::HighBeam, InputControl, FVehicleLightState::Interior, FVehicleLightState::LeftBlinker, LightState, FVehicleLightState::LowBeam, FVehicleLightState::Position, RefreshLightState(), FVehicleLightState::Reverse, FVehicleLightState::RightBlinker, FVehicleLightState::Special1, and FVehicleLightState::Special2.
| 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().
| 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().
| void ACarlaWheeledVehicle::SetWheelsFrictionScale | ( | TArray< float > & | WheelsFrictionScale | ) |
Definition at line 787 of file CarlaWheeledVehicle.cpp.
References GetChaosWheeledVehicleMovementComponent(), LastPhysicsControl, and FVehiclePhysicsControl::Wheels.
| 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().
| 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().
| void ACarlaWheeledVehicle::ShowDebugTelemetry | ( | bool | Enabled | ) |
Definition at line 1200 of file CarlaWheeledVehicle.cpp.
References ACarlaHUD::AddDebugVehicleForTelemetry(), ACarlaHUD::DebugVehicle, and GetChaosWheeledVehicleMovementComponent().
|
overrideprotectedvirtual |
Definition at line 510 of file CarlaWheeledVehicle.cpp.
References AccelerationControl, FlushVehicleControl(), GetChaosWheeledVehicleMovementComponent(), GetVehicleForwardSpeed(), IsTwoWheeledVehicle(), MakePoseWorldSpace(), PedalRotationAngle, PedalRotationDegreesPerCm, ResolveRiderComponentsIfNeeded(), VelocityControl, and WorldTransformedPose.
|
inline |
Definition at line 496 of file CarlaWheeledVehicle.h.
| void ACarlaWheeledVehicle::UpdateDetectionBox | ( | ) |
Definition at line 576 of file CarlaWheeledVehicle.cpp.
References DetectionSize, and FoliageBoundingBox.
Referenced by AVegetationManager::Tick().
|
private |
Definition at line 574 of file CarlaWheeledVehicle.h.
Referenced by ACarlaWheeledVehicle(), ActivateAccelerationControl(), ApplyVehicleAccelerationControl(), DeactivateAccelerationControl(), GetVehicleCurrentGear(), and TickActor().
|
private |
Definition at line 586 of file CarlaWheeledVehicle.h.
Referenced by ApplyVehicleAccelerationControl(), ApplyVehicleAckermannControl(), ApplyVehicleControl(), ApplyVehiclePhysicsControl(), BeginPlay(), and FlushVehicleControl().
|
private |
Definition at line 585 of file CarlaWheeledVehicle.h.
Referenced by ApplyVehicleAccelerationControl(), ApplyVehicleAckermannControl(), ApplyVehicleControl(), and FlushVehicleControl().
|
private |
Definition at line 833 of file CarlaWheeledVehicle.h.
Referenced by ACarlaWheeledVehicle(), FlushVehicleControl(), GetVehicleCurrentGear(), GetVehicleForwardSpeed(), GetVelocity(), IsSimulatedByChaos(), and SetCarlaMovementComponent().
|
private |
Definition at line 820 of file CarlaWheeledVehicle.h.
Referenced by FlushVehicleControl(), and GetVehicleCurrentGear().
|
private |
Definition at line 814 of file CarlaWheeledVehicle.h.
Referenced by ClearMirroredMotion(), GetVehicleForwardSpeed(), GetVelocity(), OnRiderBoneTransformsFinalized(), and SetMirroredMotion().
|
private |
Definition at line 598 of file CarlaWheeledVehicle.h.
Referenced by ActivateVehicleLightComponents(), and ApplyVehicleLightDefaultsForCurrentState().
| bool ACarlaWheeledVehicle::bIsNWVehicle = false |
Definition at line 800 of file CarlaWheeledVehicle.h.
Referenced by ACarlaWheeledVehicleNW::ACarlaWheeledVehicleNW().
|
private |
Definition at line 824 of file CarlaWheeledVehicle.h.
|
private |
Definition at line 826 of file CarlaWheeledVehicle.h.
|
private |
Definition at line 829 of file CarlaWheeledVehicle.h.
Referenced by IsSimulatedByChaos(), and SetSimulatePhysics().
|
private |
Definition at line 614 of file CarlaWheeledVehicle.h.
Referenced by ResolveRiderComponentsIfNeeded().
|
private |
Definition at line 875 of file CarlaWheeledVehicle.h.
Referenced by ArmSeedRewrite(), OnSeedPostTick(), and OnSeedPreTick().
|
private |
Definition at line 640 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized().
|
private |
Definition at line 838 of file CarlaWheeledVehicle.h.
Referenced by GetOverriddenWheelPoseOrWarn(), GetWheelPose(), and SetWheelAnimationOverride().
|
private |
Definition at line 631 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized().
|
private |
Definition at line 630 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized().
|
private |
Definition at line 634 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized().
|
private |
Definition at line 633 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized().
|
private |
Definition at line 632 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized().
| float ACarlaWheeledVehicle::CarSimOriginOffset = 150.f |
Definition at line 796 of file CarlaWheeledVehicle.h.
Referenced by UCarSimManagerComponent::BeginPlay().
|
private |
Definition at line 891 of file CarlaWheeledVehicle.h.
Referenced by BeginPlay(), CloseDoorPhys(), and OpenDoorPhys().
|
protected |
Definition at line 547 of file CarlaWheeledVehicle.h.
Referenced by BeginPlay().
|
private |
Definition at line 884 of file CarlaWheeledVehicle.h.
Referenced by BeginPlay(), CloseDoorPhys(), GetOpenDoorPoses(), OpenDoorPhys(), and SetMirroredDoorPoses().
|
private |
Definition at line 836 of file CarlaWheeledVehicle.h.
Referenced by BeginPlay(), CloseDoor(), CloseDoorPhys(), GetOpenDoorPoses(), OpenDoor(), OpenDoorPhys(), ResetConstraints(), and SetMirroredDoorPoses().
| FVehicleControl ACarlaWheeledVehicle::Control |
Definition at line 559 of file CarlaWheeledVehicle.h.
Referenced by ApplyVehicleControl(), SetBrakeInput(), SetHandbrakeInput(), SetReverse(), SetSteeringInput(), and SetThrottleInput().
| float ACarlaWheeledVehicle::DetectionSize { 750.0f } |
Definition at line 649 of file CarlaWheeledVehicle.h.
Referenced by GetDetectionSize(), and UpdateDetectionBox().
|
private |
Definition at line 888 of file CarlaWheeledVehicle.h.
Referenced by BeginPlay(), CloseDoorPhys(), OpenDoorPhys(), and SetMirroredDoorPoses().
|
protected |
Definition at line 550 of file CarlaWheeledVehicle.h.
Referenced by OpenDoorPhys().
|
private |
Definition at line 592 of file CarlaWheeledVehicle.h.
Referenced by ApplyRolloverBehavior(), GetFailureState(), SetFailureState(), and SetRolloverFlag().
| FBox ACarlaWheeledVehicle::FoliageBoundingBox |
Definition at line 652 of file CarlaWheeledVehicle.h.
Referenced by DrawFoliageBoundingBox(), GetDetectionBox(), GetFoliageInstancesCloseToVehicle(), IsInVehicleRange(), and UpdateDetectionBox().
| struct { ... } ACarlaWheeledVehicle::InputControl |
|
private |
Definition at line 578 of file CarlaWheeledVehicle.h.
Referenced by ApplyVehicleAckermannControl().
|
private |
Definition at line 577 of file CarlaWheeledVehicle.h.
Referenced by FlushVehicleControl(), and GetVehicleTelemetryData().
|
private |
Definition at line 579 of file CarlaWheeledVehicle.h.
Referenced by ApplyVehiclePhysicsControl(), ApplyWheelPhysicsControl(), BeginPlay(), GetWheelRadius(), GetWheelSuspensionAxis(), RestoreVehiclePhysicsControl(), and SetWheelsFrictionScale().
| FVehicleLightState ACarlaWheeledVehicle::LightState |
Definition at line 560 of file CarlaWheeledVehicle.h.
Referenced by ApplyVehicleLightDefaultsForCurrentState(), and SetVehicleLightState().
|
private |
Definition at line 818 of file CarlaWheeledVehicle.h.
Referenced by ClearMirroredMotion(), GetVehicleForwardSpeed(), and SetMirroredMotion().
|
private |
Definition at line 822 of file CarlaWheeledVehicle.h.
Referenced by GetVehicleCurrentGear().
|
private |
Definition at line 816 of file CarlaWheeledVehicle.h.
Referenced by ClearMirroredMotion(), GetVelocity(), and SetMirroredMotion().
|
private |
Definition at line 840 of file CarlaWheeledVehicle.h.
Referenced by GetOverriddenWheelPoseOrWarn(), GetWheelPose(), and SetWheelAnimationOverride().
|
private |
Definition at line 645 of file CarlaWheeledVehicle.h.
Referenced by TickActor().
| 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().
|
private |
Degrees, as drawn.
Definition at line 873 of file CarlaWheeledVehicle.h.
Referenced by ArmSeedRewrite(), DisarmSeedRewrite(), and OnSeedPostTick().
| EVehicleInputPriority ACarlaWheeledVehicle::Priority = EVehicleInputPriority::INVALID |
Definition at line 558 of file CarlaWheeledVehicle.h.
Referenced by ApplyVehicleControl().
|
private |
Definition at line 609 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized(), and ResolveRiderComponentsIfNeeded().
| 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().
| 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().
| 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().
|
private |
Definition at line 588 of file CarlaWheeledVehicle.h.
Referenced by CheckRollover().
|
private |
Definition at line 589 of file CarlaWheeledVehicle.h.
Referenced by ApplyRolloverBehavior(), CheckRollover(), and SetRolloverFlag().
|
private |
Definition at line 590 of file CarlaWheeledVehicle.h.
Referenced by ApplyRolloverBehavior().
| float ACarlaWheeledVehicle::RotationAnim { 0.0f } |
Definition at line 915 of file CarlaWheeledVehicle.h.
|
private |
Definition at line 600 of file CarlaWheeledVehicle.h.
Referenced by ActivateVehicleLightComponents(), and ApplyVehicleLightDefaultsForCurrentState().
|
private |
Definition at line 599 of file CarlaWheeledVehicle.h.
Referenced by ActivateVehicleLightComponents(), and ApplyVehicleLightDefaultsForCurrentState().
|
private |
Definition at line 879 of file CarlaWheeledVehicle.h.
Referenced by ArmSeedRewrite(), and DisarmSeedRewrite().
|
private |
Definition at line 877 of file CarlaWheeledVehicle.h.
Referenced by ArmSeedRewrite(), and DisarmSeedRewrite().
|
private |
Definition at line 639 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized().
| float ACarlaWheeledVehicle::SpeedAnim { 0.0f } |
Definition at line 914 of file CarlaWheeledVehicle.h.
|
private |
Current state of the vehicle controller (for debugging purposes).
Definition at line 568 of file CarlaWheeledVehicle.h.
|
private |
Definition at line 912 of file CarlaWheeledVehicle.h.
Referenced by ApplyRolloverBehavior().
| TObjectPtr<UBoxComponent> ACarlaWheeledVehicle::VehicleBounds |
Definition at line 655 of file CarlaWheeledVehicle.h.
Referenced by ACarlaWheeledVehicle(), AdjustVehicleBounds(), GetBoxSphereBounds(), GetVehicleBoundingBoxExtent(), and GetVehicleBoundingBoxTransform().
|
private |
Definition at line 612 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized(), and ResolveRiderComponentsIfNeeded().
| FName ACarlaWheeledVehicle::VehicleMeshSeatSocketName = TEXT("Seat") |
Definition at line 256 of file CarlaWheeledVehicle.h.
Referenced by OnRiderBoneTransformsFinalized(), and ResolveRiderComponentsIfNeeded().
|
private |
Definition at line 571 of file CarlaWheeledVehicle.h.
Referenced by ACarlaWheeledVehicle(), ActivateVelocityControl(), ApplyVehicleAccelerationControl(), DeactivateVelocityControl(), and TickActor().
| FPoseSnapshot ACarlaWheeledVehicle::WorldTransformedPose |
Definition at line 916 of file CarlaWheeledVehicle.h.
Referenced by GetWorldTransformedPose(), and TickActor().