Navigation
API > API/Plugins > API/Plugins/ChaosVehicles
Inheritance Hierarchy
- UPawnMovementComponent
- UChaosVehicleMovementComponent
- UChaosWheeledVehicleMovementComponent
References
| Module | ChaosVehicles |
| Header | /Engine/Plugins/Experimental/ChaosVehiclesPlugin/Source/ChaosVehicles/Public/ChaosVehicleMovementComponent.h |
| Include | #include "ChaosVehicleMovementComponent.h" |
Syntax
UCLASS (Abstract,
HideCategories=(PlanarMovement, "Components|Movement|Planar", Activation, "Components|Activation"))
class UChaosVehicleMovementComponent : public UPawnMovementComponent
Remarks
Base component to handle the vehicle simulation for an actor.
Variables
| Type | Name | Description | |
|---|---|---|---|
| TArray< FVehicleAerofoilConfig > | Aerofoils | Optional aerofoil setup - can be used for car spoilers or aircraft wings/elevator/rudder | |
| float | AngErrorAccumulator | Accumulator for RB replication errors | |
| bool | bEnableCenterOfMassOverride | Enable to override the calculated COM position with your own fixed value - this prevents the vehicle handling changing when the asset changes | |
| uint8: 1 | bParkEnabled | ||
| float | BrakeInput | Brake output to physics system. Range 0...1. | |
| FVehicleInputRateConfig | BrakeInputRate | Rate at which input brake can rise and fall. | |
| uint8: 1 | bRawGearDownInput | True if the player is holding gear down. | |
| uint8: 1 | bRawGearUpInput | True if the player is holding gear up. | |
| uint8: 1 | bRawHandbrakeInput | True if the player is holding the handbrake. | |
| bool | bRequiresControllerForInputs | Bypass the need for a controller in order for the controls to be processed. | |
| uint8: 1 | bReverseAsBrake | If true, the brake and reverse controls will behave in a more arcade fashion where holding reverse also functions as brake. | |
| uint8: 1 | bThrottleAsBrake | If true, when reversing the throttle will behave like a brake while the vehicle moving in a backwards direction - requires bReverseAsBrake to be enabled for operation | |
| bool | bUsingNetworkPhysicsPrediction | ||
| uint32: 1 | bWasAvoidanceUpdated | Was avoidance updated in this frame? | |
| FVector | CenterOfMassOverride | The center of mass override value, this value overrides the calculated COM and the COM offset value in the mesh is also ignored. | |
| float | ChassisHeight | Chassis height used for drag force computation (cm) | |
| float | ChassisWidth | Chassis width used for drag force computation (cm) | |
| FChaosVehicleAsyncInput * | CurAsyncInput | ||
| FChaosVehicleAsyncOutput * | CurAsyncOutput | ||
| EChaosAsyncVehicleDataType | CurAsyncType | ||
| float | DebugDragMagnitude | Debug drag magnitude last applied. | |
| float | DownforceCoefficient | DownforceCoefficient of the vehicle chassis - force pressing vehicle into ground at speed | |
| float | DragArea | Drag area in Meters^2. | |
| float | DragCoefficient | DragCoefficient of the vehicle chassis - force resisting forward motion at speed | |
| float | HandbrakeInput | Handbrake output to physics system. Range 0...1. | |
| FVehicleInputRateConfig | HandbrakeInputRate | Rate at which input handbrake can rise and fall. | |
| float | IdleBrakeInput | How much to press the brake when the player has release throttle. | |
| FVector | InertiaTensorScale | Scales the vehicle's inertia in each direction (forward, right, up) | |
| float | Mass | Mass to set the vehicle chassis to. | |
| FDelegateHandle | MeshOnPhysicsStateChangeHandle | Handle for delegate registered on mesh component | |
| TObjectPtr< UNetworkPhysicsComponent > | NetworkPhysicsComponent | ||
| FChaosVehicleAsyncOutput * | NextAsyncOutput | ||
| float | OutputInterpAlpha | ||
| TArray< FAsyncOutputWrapper > | OutputsWaitingOn | ||
| TObjectPtr< AController > | OverrideController | ||
| Chaos::FSimpleAerodynamicsConfig | PAerodynamicsSetup | ||
| float | PitchInput | Body Pitch output to physics system. Range -1...1. | |
| FVehicleInputRateConfig | PitchInputRate | Rate at which input pitch can rise and fall. | |
| float | PrevReplicatedSteeringInput | ||
| float | PrevSteeringInput | ||
| TUniquePtr< FPhysicsVehicleOutput > | PVehicleOutput | ||
| float | RawBrakeInput | What the player has the brake set to. Range -1...1. | |
| float | RawPitchInput | What the player has the pitch set to. Range -1...1. | |
| float | RawRollInput | What the player has the roll set to. Range -1...1. | |
| float | RawSteeringInput | What the player has the steering set to. Range -1...1. | |
| float | RawThrottleInput | What the player has the accelerator set to. Range -1...1. | |
| float | RawYawInput | What the player has the yaw set to. Range -1...1. | |
| FVehicleReplicatedState | ReplicatedState | Replicated state of vehicle | |
| float | RollInput | Body Roll output to physics system. Range -1...1. | |
| FVehicleInputRateConfig | RollInputRate | Rate at which input roll can rise and fall. | |
| float | SleepSlopeLimit | Option to apply some aggressive sleep logic if slopes up Z is less than this value, i.e value = Cos(SlopeAngle) so 0.866 will sleep up to 30 degree slopes | |
| float | SleepThreshold | Option to apply some aggressive sleep logic, larger number is more agressive, 0 disables | |
| FVehicleStabilizeControlConfig | StabilizeControl | Arcade style control of vehicle | |
| float | SteeringInput | Steering output to physics system. Range -1...1. | |
| FVehicleInputRateConfig | SteeringInputRate | Rate at which input steering can rise and fall. | |
| float | StopThreshold | Auto-brake when absolute vehicle forward speed is less than this (cm/s) | |
| int32 | TargetGear | ||
| FVehicleTargetRotationControlConfig | TargetRotationControl | Arcade style direct control of vehicle rotation via torque force | |
| float | ThrottleInput | Accelerator output to physics system. Range 0...1. | |
| FVehicleInputRateConfig | ThrottleInputRate | Rate at which input throttle can rise and fall. | |
| TArray< FVehicleThrustConfig > | Thrusters | Optional thruster setup, use one or more as your main engine or as supplementary booster | |
| FVehicleTorqueControlConfig | TorqueControl | Arcade style direct control of vehicle rotation via torque force | |
| Chaos::ETransmissionType | TransmissionType | ||
| uint32 | VehicleSetupTag | Used to recreate the physics if the blueprint changes. | |
| TUniquePtr< UChaosVehicleSimulation > | VehicleSimulationPT | ||
| FVehicleState | VehicleState | ||
| float | WrongDirectionThreshold | Auto-brake when vehicle forward speed is opposite of player input by at least this much (cm/s) | |
| float | YawInput | Body Yaw output to physics system. Range -1...1. | |
| FVehicleInputRateConfig | YawInputRate | Rate at which input yaw can rise and fall. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UChaosVehicleMovementComponent
(
const FObjectInitializer& ObjectInitializer |
UChaosVehicleMovementComponent |
Functions
| Type | Name | Description | |
|---|---|---|---|
| float | Compute handbrake input | ||
| float | Compute pitch input | ||
| float | Compute roll input | ||
| float | Compute steering input | ||
| void | CalcThrottleBrakeInput
(
float& ThrottleOut, |
Compute throttle & brake input | |
| float | |||
| float | Compute throttle inputs | ||
| float | CalcYawInput () |
Compute yaw input | |
| bool | Return true if we are ready to create a vehicle, false if the setup has missing references | ||
| void | |||
| void | ClearInput () |
Clear all interpolated inputs to default values. | |
| void | Clear all raw inputs to default values. | ||
| void | When vehicle is created we want to compute some helper data like drag area, etc.... | ||
| TUniquePtr< Chaos::FSimpleWheeledVehicle > | |||
| void | Create and setup the Chaos vehicle | ||
| void | DecreaseThrottleInput
(
float ThrottleDelta |
Decrease the vehicle throttle position [throttle range normalized 0 to 1] | |
| void | DrawDebug
(
UCanvas* Canvas, |
Draw debug text for the wheels and suspension | |
| void | DrawLine2D
(
UCanvas* Canvas, |
Draw 2D debug line to UI canvas | |
| void | EnableSelfRighting
(
bool InState |
||
| void | |||
| void | |||
| void | Skeletal mesh needs some special handling in the vehicle case | ||
| const Chaos::FSimpleAerodynamicsConfig & | |||
| void | GetBaseSnapshot
(
FBaseSnapshotData& SnapshotOut |
Grab a snapshot of the vehicle instance dynamic state | |
| const FBodyInstance * | |||
| FBodyInstance * | |||
| float | Get the user input for the vehicle brake - can use this to feed control to a connected trailer | ||
| AController * | Get our controller | ||
| int32 | Get current gear | ||
| float | |||
| float | How fast the vehicle is moving forward | ||
| float | How fast the vehicle is moving forward | ||
| bool | Get the user input for the vehicle handbrake - can use this to feed control to a connected trailer | ||
| UMeshComponent * | GetMesh () |
Get the mesh this vehicle is tied to | |
| APlayerController * | Retrieve the player controller of the vehicle component | ||
| USkeletalMeshComponent * | Get Mesh cast as USkeletalMeshComponent, may return null if cast fails | ||
| UStaticMeshComponent * | Get Mesh cast as UStaticMeshComponent, may return null if cast fails | ||
| float | Get the user input for the vehicle steering - can use this to feed control to a connected trailer | ||
| float | GetSuspensionOffset
(
int WheelIndex |
||
| int32 | Get target gear | ||
| float | Get the user input for the vehicle throttle - can use this to feed control to a connected trailer | ||
| bool | Are gears being changed automatically? | ||
| bool | Returns true if the physics state exists | ||
| void | IncreaseThrottleInput
(
float ThrottleDelta |
Increase the vehicle throttle position [throttle range normalized 0 to 1] | |
| bool | IsParked () |
Is the vehicle in park mode | |
| FVector | LocateBoneOffset
(
const FName InBoneName, |
Location local coordinates of named bone in skeleton, apply additional offset or just use offset if no bone located | |
| void | Used to create any physics engine information for this component | ||
| void | Used to shut down and physics engine structure for this component | ||
| void | ParallelUpdate
(
float DeltaSeconds |
Get output data from Physics Thread. | |
| TUniquePtr< FPhysicsVehicleOutput > & | |||
| void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
End UObject interface Respond to a property change in editor | |
| void | Do some final setup after the Chaos vehicle gets created | ||
| void | PreTickGT
(
float DeltaTime |
Updates the vehicle tuning and other state such as user input. | |
| void | ProcessSleeping
(
const FControlInputs& ControlInputs |
Option to aggressively sleep the vehicle | |
| void | |||
| void | ResetVehicle () |
Reset some vehicle state - call this if you are say creating pool of vehicles that get reused and you don't want to carry over the previous state | |
| void | |||
| void | UObject interface | ||
| void | ServerUpdateState
(
float InSteeringInput, |
Pass current state to server | |
| void | SetBaseSnapshot
(
const FBaseSnapshotData& SnapshotIn |
Set snapshot of vehicle instance dynamic state | |
| void | SetBrakeInput
(
float Brake |
Set the user input for the vehicle Brake [range 0 to 1] | |
| void | SetChangeDownInput
(
bool bNewGearDown |
Set the user input for gear down | |
| void | SetChangeUpInput
(
bool bNewGearUp |
Set the user input for gear up | |
| TUniquePtr< FChaosVehicleAsyncInput > | SetCurrentAsyncInputOutput
(
int32 InputIdx, |
||
| void | SetCurrentAsyncInputOutputInternal
(
FChaosVehicleAsyncInput* CurInput, |
||
| void | SetCurrentAsyncInputOutputInternal
(
FChaosVehicleAsyncInput* CurInput, |
||
| void | SetHandbrakeInput
(
bool bNewHandbrake |
Set the user input for handbrake | |
| void | SetOverrideController
(
AController* OverrideController |
Allow the player controller of a different pawn to control this vehicle | |
| void | SetParked
(
bool bParked |
Set the vehicle in park mode | |
| void | SetPitchInput
(
float Pitch |
Set the user input for the vehicle pitch [range -1 to 1] | |
| void | SetRequiresControllerForInputs
(
bool bRequiresController |
Set the flag that determines whether a controller is required to set control inputs | |
| void | SetRollInput
(
float Roll |
Set the user input for the vehicle roll [range -1 to 1] | |
| void | SetSleeping
(
bool bEnableSleep |
Set the vehicle sleeping (bEnableSleep=true) or wake it up (bEnableSleep=false) | |
| void | SetSteeringInput
(
float Steering |
Set the user input for the vehicle steering [range -1 to 1] | |
| void | SetTargetGear
(
int32 GearNum, |
Set the user input for gear (-1 reverse, 0 neutral, 1+ forward) | |
| void | SetThrottleInput
(
float Throttle |
Set the user input for the vehicle throttle [range 0 to 1] | |
| void | SetUpdatedComponent
(
USceneComponent* NewUpdatedComponent |
Overridden to allow registration with components NOT owned by a Pawn. | |
| void | SetupVehicle
(
TUniquePtr< Chaos::FSimpleWheeledVehicle >& PVehicle |
Allocate and setup the Chaos vehicle | |
| void | Adjust the Chaos Physics mass | ||
| void | SetUseAutomaticGears
(
bool bUseAuto |
Set the flag that will be used to select auto-gears | |
| void | SetYawInput
(
float Yaw |
Set the user input for the vehicle yaw [range -1 to 1] | |
| bool | Return true if it's suitable to create a physics representation of the vehicle at this time | ||
| void | ShowDebugInfo
(
AHUD* HUD, |
||
| void | Stops movement immediately (zeroes velocity, usually zeros acceleration for components with acceleration). | ||
| void | Update
(
float DeltaTime |
||
| void | UpdateMassProperties
(
FBodyInstance* BI |
||
| void | UpdateState
(
float DeltaTime |
Read current state for simulation | |
| void |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FAsyncOutputWrapper |