CARLA
Loading...
Searching...
No Matches
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/WheelPhysicsControl.h
Go to the documentation of this file.
1// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9#include <util/ue-header-guard-begin.h>
10#include "ChaosVehicleWheel.h"
11#include <util/ue-header-guard-end.h>
12
13#include "WheelPhysicsControl.generated.h"
14
15USTRUCT(BlueprintType)
16struct CARLA_API FWheelPhysicsControl
17{
18 GENERATED_BODY()
19
21 AxleType(EAxleType::Undefined),
22 Offset(FVector(0.0f, 0.0f, 0.0f)),
23 WheelRadius(1.0f),
24 WheelWidth(1.0f),
25 WheelMass(1),
28 SideSlipModifier(0.5f),
29 SlipThreshold(1.0f),
30 SkidThreshold(1.0f),
31 MaxSteerAngle(60.0f),
33 bAffectedByBrake(true),
36 bABSEnabled(true),
39 ExternalTorqueCombineMethod(ETorqueCombineMethod::None),
40 LateralSlipGraph(FRichCurve()),
41 SuspensionAxis(FVector(0.0f, 0.0f, 1.0f)),
46 WheelLoadRatio(0.5f),
47 SpringRate(1.0f),
48 SpringPreload(1.0f),
50 RollbarScaling(0.0f),
51 SweepShape(ESweepShape::Spherecast),
52 SweepType(ESweepType::ComplexSweep),
53 MaxBrakeTorque(1.0f),
55 WheelIndex(0),
56 Location(FVector(0.0f, 0.0f, 0.0f)),
57 OldLocation(FVector(0.0f, 0.0f, 0.0f)),
58 Velocity(FVector(0.0f, 0.0f, 0.0f))
59 {
60
61 }
62 /** If left undefined then the bAffectedByEngine value is used, if defined then bAffectedByEngine is ignored and the differential setup on the vehicle defines which wheels get power from the engine */
63 UPROPERTY(EditAnywhere, Category = Wheel)
64 EAxleType AxleType;
65
66 /**
67 * If BoneName is specified, offset the wheel from the bone's location.
68 * Otherwise this offsets the wheel from the vehicle's origin.
69 */
70 UPROPERTY(EditAnywhere, Category = Wheel)
71 FVector Offset;
72
73 /** Radius of the wheel */
74 UPROPERTY(EditAnywhere, Category = Wheel, meta = (ClampMin = "0.01", UIMin = "0.01"))
76
77 /** Width of the wheel */
78 UPROPERTY(EditAnywhere, Category = Wheel, meta = (ClampMin = "0.01", UIMin = "0.01"))
80
81 /** Mass of the wheel Kg */
82 UPROPERTY(EditAnywhere, Category = Wheel, meta = (ClampMin = "0.01", UIMin = "0.01"))
83 float WheelMass;
84
85 /** Tyre Cornering Ability */
86 UPROPERTY(EditAnywhere, Category = Wheel)
88
89 /** Friction Force Multiplier */
90 UPROPERTY(EditAnywhere, Category = Wheel)
92
93 /** Wheel Lateral Skid Grip Loss, lower number less grip on skid */
94 UPROPERTY(EditAnywhere, Category = Wheel, meta = (ClampMin = "0.0", UIMin = "0.0", ClampMax = "1.0", UIMax = "1.0"))
96
97 /** Wheel Longitudinal Slip Threshold */
98 UPROPERTY(EditAnywhere, Category = Wheel, meta = (ClampMin = "0.0", UIMin = "0.0"))
100
101 /** Wheel Lateral Skid Threshold */
102 UPROPERTY(EditAnywhere, Category = Wheel, meta = (ClampMin = "0.0", UIMin = "0.0"))
104
105 // steer angle in degrees for this wheel
106 UPROPERTY(EditAnywhere, Category = WheelsSetup)
108
109 /** Whether steering should affect this wheel */
110 UPROPERTY(EditAnywhere, Category = WheelsSetup)
112
113 /** Whether brake should affect this wheel */
114 UPROPERTY(EditAnywhere, Category = Wheel)
116
117 /** Whether handbrake should affect this wheel */
118 UPROPERTY(EditAnywhere, Category = Wheel)
120
121 /** Whether engine should power this wheel */
122 UPROPERTY(EditAnywhere, Category = Wheel)
124
125 /** Advanced Braking System Enabled */
126 UPROPERTY(EditAnywhere, Category = Wheel)
128
129 /** Straight Line Traction Control Enabled */
130 UPROPERTY(EditAnywhere, Category = Wheel)
132
133 /** Max Wheelspin rotation rad/sec */
134 UPROPERTY(EditAnywhere, Category = Wheel)
136
137 /** Determines how the SetDriveTorque/SetBrakeTorque inputs are combined with the internal torques */
138 UPROPERTY(EditAnywhere, Category = Wheel)
139 ETorqueCombineMethod ExternalTorqueCombineMethod;
140
141 UPROPERTY(EditAnywhere, Category = Setup)
143
144 /** Local body direction in which where suspension forces are applied (typically along -Z-axis) */
145 UPROPERTY(EditAnywhere, Category = Suspension)
147
148 /** Vertical offset from where suspension forces are applied (along Z-axis) */
149 UPROPERTY(EditAnywhere, Category = Suspension)
151
152 /** How far the wheel can go above the resting position */
153 UPROPERTY(EditAnywhere, Category = Suspension)
155
156 /** How far the wheel can drop below the resting position */
157 UPROPERTY(EditAnywhere, Category = Suspension)
159
160 /** Suspension damping, larger value causes the suspension to come to rest faster [range 0 to 1] */
161 UPROPERTY(EditAnywhere, Category = Suspension)
163
164 /**
165 * Amount wheel load effects wheel friction.
166 At 0 wheel friction is completely independent of the loading on the wheel (This is artificial as it always assumes even balance between all wheels)
167 At 1 wheel friction is based on the force pressing wheel into the ground. This is more realistic.
168 Lower value cures lift off over-steer, generally makes vehicle easier to handle under extreme motions.
169 */
170 UPROPERTY(EditAnywhere, Category = Suspension, meta = (ClampMin = "0.0", UIMin = "0.0", ClampMax = "1.0", UIMax = "1.0"))
172
173 /** Spring Force (N/m) */
174 UPROPERTY(EditAnywhere, Category = Suspension)
176
177 /** Spring Preload (N/m) */
178 UPROPERTY(EditAnywhere, Category = Suspension)
180
181 /** Smooth suspension [0-off, 10-max] - Warning might cause momentary visual inter-penetration of the wheel against objects/terrain */
182 UPROPERTY(EditAnywhere, Category = Suspension, meta = (ClampMin = "0.0", UIMin = "0", ClampMax = "10.0", UIMax = "10"))
184
185 /** Anti-roll effect */
186 UPROPERTY(EditAnywhere, Category = Suspension, meta = (ClampMin = "0.0", UIMin = "0", ClampMax = "1.0", UIMax = "1"))
188
189 /** Wheel suspension trace type, defaults to ray trace */
190 UPROPERTY(EditAnywhere, Category = Suspension)
191 ESweepShape SweepShape;
192
193 /** Whether wheel suspension considers simple, complex */
194 UPROPERTY(EditAnywhere, Category = Suspension)
195 ESweepType SweepType;
196
197 /** max brake torque for this wheel (Nm) */
198 UPROPERTY(EditAnywhere, Category = Brakes)
200
201 /**
202 * Max handbrake brake torque for this wheel (Nm). A handbrake should have a stronger brake torque
203 * than the brake. This will be ignored for wheels that are not affected by the handbrake.
204 */
205 UPROPERTY(EditAnywhere, Category = Brakes)
207
208 // Our index in the vehicle's (and setup's) wheels array
209 UPROPERTY(transient)
211
212 // Worldspace location of this wheel
213 UPROPERTY(transient)
214 FVector Location;
215
216 // Worldspace location of this wheel last frame
217 UPROPERTY(transient)
218 FVector OldLocation;
219
220 // Current velocity of the wheel center (change in location over time)
221 UPROPERTY(Category = "Wheel Position", EditAnywhere, BlueprintReadWrite)
222 FVector Velocity;
223
224};
ETorqueCombineMethod ExternalTorqueCombineMethod
Determines how the SetDriveTorque/SetBrakeTorque inputs are combined with the internal torques.
float SuspensionMaxRaise
How far the wheel can go above the resting position.
int SuspensionSmoothing
Smooth suspension [0-off, 10-max] - Warning might cause momentary visual inter-penetration of the whe...
ESweepShape SweepShape
Wheel suspension trace type, defaults to ray trace.
FVector SuspensionForceOffset
Vertical offset from where suspension forces are applied (along Z-axis).
float MaxHandBrakeTorque
Max handbrake brake torque for this wheel (Nm).
FVector Offset
If BoneName is specified, offset the wheel from the bone's location.
float SideSlipModifier
Wheel Lateral Skid Grip Loss, lower number less grip on skid.
float SuspensionMaxDrop
How far the wheel can drop below the resting position.
FVector SuspensionAxis
Local body direction in which where suspension forces are applied (typically along -Z-axis).
EAxleType AxleType
If left undefined then the bAffectedByEngine value is used, if defined then bAffectedByEngine is igno...
float SuspensionDampingRatio
Suspension damping, larger value causes the suspension to come to rest faster [range 0 to 1].
ESweepType SweepType
Whether wheel suspension considers simple, complex.