UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AerodynamicsSystem.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Math/MathFwd.h"
7#include "VehicleUtility.h"
8
9#if VEHICLE_DEBUGGING_ENABLED
11#endif
12
13namespace Chaos
14{
15 /*
16 * Simple Aerodynamics - calculates drag and down-force/lift-force for a given speed
17 *
18 * #todo: Add options for drafting/Slipstreaming effect
19 * #todo: Proper defaults
20 */
21
23 {
25 : AreaMetresSquared(2.0f)
26 , DragCoefficient(0.1f)
27 , DownforceCoefficient(0.1f)
28 {
29
30 }
31
32 // FVector Offet; // local offset relative to CM
33 float AreaMetresSquared; // [meters squared]
34 float DragCoefficient; // always positive
35 float DownforceCoefficient; // positive for downforce, negative lift
36
37 };
38
39
40 class CHAOSVEHICLESCORE_API FSimpleAerodynamicsSim : public TVehicleSystem<FSimpleAerodynamicsConfig>
41 {
42 public:
44
47 {
48 DensityOfMedium = DensityIn;
49 }
50
52 {
53 DragCoefficient = InCoeffient;
54 EffectiveDragConstant = 0.5f * Setup().AreaMetresSquared * DragCoefficient;
55 }
56
58 {
59 DownforceCoefficient = InCoeffient;
60 EffectiveLiftConstant = 0.5f * Setup().AreaMetresSquared * DownforceCoefficient;
61 }
62
65 {
66 return -EffectiveDragConstant * DensityOfMedium * VelocityIn * VelocityIn;
67 }
68
71 {
72 return -EffectiveLiftConstant * DensityOfMedium * VelocityIn * VelocityIn;
73 }
74
76 FVector GetCombinedForces(float VelocityIn);
77
78 protected:
84
85 };
86
87} // namespace Chaos
88
89#if VEHICLE_DEBUGGING_ENABLED
91#endif
#define UE_ENABLE_OPTIMIZATION
Definition CoreMiscDefines.h:60
#define UE_DISABLE_OPTIMIZATION
Definition CoreMiscDefines.h:59
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition AerodynamicsSystem.h:41
float GetLiftForceFromVelocity(float VelocityIn)
Definition AerodynamicsSystem.h:70
float EffectiveDragConstant
Definition AerodynamicsSystem.h:82
float DragCoefficient
Definition AerodynamicsSystem.h:80
void SetDownforceCoefficient(float InCoeffient)
Definition AerodynamicsSystem.h:57
float EffectiveLiftConstant
Definition AerodynamicsSystem.h:83
float DownforceCoefficient
Definition AerodynamicsSystem.h:79
float DensityOfMedium
Definition AerodynamicsSystem.h:81
float GetDragForceFromVelocity(float VelocityIn)
Definition AerodynamicsSystem.h:64
void SetDragCoefficient(float InCoeffient)
Definition AerodynamicsSystem.h:51
void SetDensityOfMedium(float DensityIn)
Definition AerodynamicsSystem.h:46
Definition VehicleSystemTemplate.h:13
Definition SkeletalMeshComponent.h:307
Definition AerodynamicsSystem.h:23
FSimpleAerodynamicsConfig()
Definition AerodynamicsSystem.h:24
float DragCoefficient
Definition AerodynamicsSystem.h:34
float DownforceCoefficient
Definition AerodynamicsSystem.h:35
float AreaMetresSquared
Definition AerodynamicsSystem.h:33