UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ThrustSystem.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
7#include "Math/Vector.h"
9#include "VehicleUtility.h"
10
11#if VEHICLE_DEBUGGING_ENABLED
13#endif
14
15namespace Chaos
16{
17 enum class EThrustType : uint8
18 {
19 Fixed = 0,
20 Wing,
21 Rudder,
24 };
25
37
38 class CHAOSVEHICLESCORE_API FSimpleThrustSim : public TVehicleSystem<FSimpleThrustConfig>
39 {
40 public:
41
43
45 {
46 ThrottlePosition = FMath::Clamp(InThrottle, -1.f, 1.f);
47 }
48
49 void SetPitch(float InPitch)
50 {
51 Pitch = -FMath::Clamp(InPitch, -1.f, 1.f) * Setup().MaxControlAngle;
52 }
53
54 void SetRoll(float InRoll)
55 {
56 Roll = FMath::Clamp(InRoll, -1.f, 1.f) * Setup().MaxControlAngle;
57 }
58
59 void SetYaw(float InYaw)
60 {
61 Yaw = FMath::Clamp(InYaw, -1.f, 1.f) * Setup().MaxControlAngle;
62 }
63
64
66 {
67 WorldVelocity = InVelocity;
68 }
69
70 // Get functions
71 const FVector& GetThrustForce() const
72 {
73 return ThrustForce;
74 }
75
77 {
78 return ThrustDirection;
79 }
80
81 const FVector GetThrustLocation() const;
82
83 // simulate
84 void Simulate(float DeltaTime);
85
86 protected:
87
88 float ThrottlePosition; // [0..1 Normalized position]
89
92
93 bool ThrusterStarted; // is the 'engine' turned off or has it been started
94
96
97 float Pitch;
98 float Roll;
99 float Yaw;
100
101 };
102
103} // namespace Chaos
104
105#if VEHICLE_DEBUGGING_ENABLED
107#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
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition ThrustSystem.h:39
float Roll
Definition ThrustSystem.h:98
FVector ThrustDirection
Definition ThrustSystem.h:91
const FVector & GetThrustDirection() const
Definition ThrustSystem.h:76
bool ThrusterStarted
Definition ThrustSystem.h:93
void SetThrottle(float InThrottle)
Definition ThrustSystem.h:44
void SetWorldVelocity(const FVector &InVelocity)
Definition ThrustSystem.h:65
FVector ThrustForce
Definition ThrustSystem.h:90
void SetYaw(float InYaw)
Definition ThrustSystem.h:59
const FVector & GetThrustForce() const
Definition ThrustSystem.h:71
void SetPitch(float InPitch)
Definition ThrustSystem.h:49
FVector WorldVelocity
Definition ThrustSystem.h:95
void SetRoll(float InRoll)
Definition ThrustSystem.h:54
float Yaw
Definition ThrustSystem.h:99
float ThrottlePosition
Definition ThrustSystem.h:88
float Pitch
Definition ThrustSystem.h:97
Definition Array.h:670
Definition VehicleSystemTemplate.h:13
Definition SkeletalMeshComponent.h:307
EThrustType
Definition ThrustSystem.h:18
Definition ThrustSystem.h:27
FVector Offset
Definition ThrustSystem.h:29
FVector Axis
Definition ThrustSystem.h:30
EThrustType Type
Definition ThrustSystem.h:28
float MaxThrustForce
Definition ThrustSystem.h:33
float MaxSpeed
Definition ThrustSystem.h:32
TArray< float > Curve
Definition ThrustSystem.h:31
float MaxControlAngle
Definition ThrustSystem.h:34
static constexpr UE_FORCEINLINE_HINT T Clamp(const T X, const T MinValue, const T MaxValue)
Definition UnrealMathUtility.h:592