A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
VRGlobalSettings.h
Go to the documentation of this file.
1#pragma once
2
3#include "GameFramework/PlayerInput.h"
4#include "GameFramework/InputSettings.h"
5#include "VRBPDatatypes.h"
8#include "VRGlobalSettings.generated.h"
9
11
12
13/*namespace ControllerProfileStatics
14{
15 static const FTransform OculusTouchStaticOffset(FRotator(-70.f, 0.f, 0.f));
16}*/
17
18// As of 4.24 these do nothing, they are left for a few versions as a reference of old bindings
19// #TODO: Delete around 4.26
20/*USTRUCT(BlueprintType, Category = "VRGlobalSettings")
21struct FAxisMappingDetails
22{
23 GENERATED_BODY()
24public:
25
26 // List of all axis key mappings that correspond to the axis name in the containing map
27 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Input")
28 TArray<FInputAxisKeyMapping> AxisMappings;
29
30};
31
32// As of 4.24 these do nothing, they are left for a few versions as a reference of old bindings
33// #TODO: Delete around 4.26
34USTRUCT(BlueprintType, Category = "VRGlobalSettings")
35struct FActionMappingDetails
36{
37 GENERATED_BODY()
38public:
39
40 // List of all axis key mappings that correspond to the axis name in the containing map
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Input")
42 TArray<FInputActionKeyMapping> ActionMappings;
43};*/
45USTRUCT(BlueprintType, Category = "ControllerProfiles")
46struct VREXPANSIONPLUGIN_API FBPVRControllerProfile
47{
49public:
50
51 // Name of controller profile
52 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ControllerProfiles")
53 FName ControllerName;
54
55 // Offset to use with this controller
56 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ControllerProfiles")
57 FTransform_NetQuantize SocketOffsetTransform;
58
59 // Offset to use with this controller
60 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ControllerProfiles")
61 bool bUseSeperateHandOffsetTransforms;
63 // Offset to use with this controller
64 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ControllerProfiles", meta = (editcondition = "bUseSeperateHandOffsetTransforms"))
65 FTransform_NetQuantize SocketOffsetTransformRightHand;
66
67 // Setting an axis value here with key bindings will override the equivalent bindings on profile load
68 // As of 4.24 these do nothing, they are left for a few versions as a reference of old bindings
69 // #TODO: Delete around 4.26
70 /*UPROPERTY(EditDefaultsOnly, NotReplicated, Category = "ControllerProfiles")
71 TMap<FName, FAxisMappingDetails> AxisOverrides;
72
73 // Setting action mappings here will override the equivalent bindings on profile load
74 // As of 4.24 these do nothing, they are left for a few versions as a reference of old bindings
75 // #TODO: Delete around 4.26
76 UPROPERTY(EditDefaultsOnly, NotReplicated, Category = "ControllerProfiles")
77 TMap<FName, FActionMappingDetails> ActionOverrides;*/
78
81 ControllerName(NAME_None),
82 SocketOffsetTransform(FTransform::Identity),
83 bUseSeperateHandOffsetTransforms(false),
84 SocketOffsetTransformRightHand(FTransform::Identity)
85 {}
86
87 FBPVRControllerProfile(FName ControllerName) :
88 ControllerName(ControllerName),
89 SocketOffsetTransform(FTransform::Identity),
90 bUseSeperateHandOffsetTransforms(false),
91 SocketOffsetTransformRightHand(FTransform::Identity)
92 {}
93
94 FBPVRControllerProfile(FName ControllerNameIn, const FTransform & Offset) :
95 ControllerName(ControllerNameIn),
96 SocketOffsetTransform(Offset),
97 bUseSeperateHandOffsetTransforms(false),
98 SocketOffsetTransformRightHand(FTransform::Identity)
99 {}
100
101 FBPVRControllerProfile(FName ControllerNameIn, const FTransform & Offset, const FTransform & OffsetRight) :
102 ControllerName(ControllerNameIn),
103 SocketOffsetTransform(Offset),
104 bUseSeperateHandOffsetTransforms(true),
105 SocketOffsetTransformRightHand(OffsetRight)
106 {}
107
108 FORCEINLINE bool operator==(const FBPVRControllerProfile &Other) const
109 {
110 return this->ControllerName == Other.ControllerName;
112};
113
114UCLASS(config = Engine, defaultconfig)
115class VREXPANSIONPLUGIN_API UVRGlobalSettings : public UObject
116{
117 GENERATED_BODY()
118
119public:
120 UVRGlobalSettings(const FObjectInitializer& ObjectInitializer);
122 // The skeletal mesh component class to use for grippable characters
123 // If you set this to none it will fall back to the default grippable class so that it doesn't brick your project
124 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "Misc")
125 TSubclassOf<class UGrippableSkeletalMeshComponent> DefaultGrippableCharacterMeshComponentClass;
126
127 // Using a getter to stay safe from bricking peoples projects if they set it to none somehow
128 static TSubclassOf<class UGrippableSkeletalMeshComponent> GetDefaultGrippableCharacterMeshComponentClass();
129
130 // A scaler to apply to constraint drives when chaos is active
131 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "ChaosPhysics")
132 float LinearDriveStiffnessScale;
133
134 // A scaler to apply to constraint drives when chaos is active
135 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "ChaosPhysics")
136 float LinearDriveDampingScale;
137
138 // A scaler to apply to constraint drives when chaos is active
139 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "ChaosPhysics")
140 float AngularDriveStiffnessScale;
141
142 // A scaler to apply to constraint drives when chaos is active
143 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "ChaosPhysics")
144 float AngularDriveDampingScale;
145
146 // If we should lerp hybrid with sweep grips out of collision
147 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "HybridWithSweepLerp")
148 bool bLerpHybridWithSweepGrips;
149
150 // If true we only lerp the rotation of hybrid grips
151 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "HybridWithSweepLerp")
152 bool bOnlyLerpHybridRotation;
153
154 // If true we calculate a speed off of the lerp duration and TInterp using it
155 // The Hybrid with sweep lerp duration then is used to divide 1.0f (x10) to get the speed (lower duration = faster movement)
156 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "HybridWithSweepLerp")
157 bool bHybridWithSweepUseDistanceBasedLerp;
158
159 // Duration that the typical lerp takes, for the distance based lerp this is turned into a speed value based off of 1.0f / it
160 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "HybridWithSweepLerp")
161 float HybridWithSweepLerpDuration;
162
163 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
164 bool bUseGlobalLerpToHand;
165
166 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
167 bool bSkipLerpToHandIfHeld;
168
169 // If the initial grip distance is closer than this value then the lerping will not be performed.
170 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
171 float MinDistanceForLerp;
172
173 // How many seconds the lerp should take
174 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
175 float LerpDuration;
176
177 // The minimum speed (in UU per second) that that the lerp should have across the initial grip distance
178 // Will speed the LerpSpeed up to try and maintain this initial speed if required
179 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
180 float MinSpeedForLerp;
181
182 // The maximum speed (in UU per second) that the lerp should have across the initial grip distance
183 // Will slow the LerpSpeed down to try and maintain this initial speed if required
184 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
185 float MaxSpeedForLerp;
186
187 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
188 EVRLerpInterpolationMode LerpInterpolationMode;
189
190 // Whether to use a curve map to map the lerp to
191 UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand|Curve")
192 bool bUseCurve;
193
194 // The curve to follow when using a curve map, only uses from 0.0 - 1.0 of the curve timeline and maps it across the entire duration
195 UPROPERTY(config, Category = "GlobalLerpToHand|Curve", EditAnywhere, meta = (editcondition = "bUseCurve"))
196 FRuntimeFloatCurve OptionalCurveToFollow;
198 // Alter the values of the virtual stock settings and save them out
199 UFUNCTION(BlueprintPure, Category = "GlobalLerpToHand")
200 static bool IsGlobalLerpEnabled();
201
202 // How many passes CCD will take during simulation, larger values significantly increase the cost of CCD calculation but also prevent tunneling artifacts
203 // Physx only
204 UPROPERTY(config, EditAnywhere, Category = "Physics")
205 int MaxCCDPasses;
207 // List of surfaces and their properties for the melee script
208 UPROPERTY(config, EditAnywhere, Category = "MeleeSettings")
209 TArray<FBPHitSurfaceProperties> MeleeSurfaceSettings;
210
211 // Default global virtual stock settings for the gun script
212 UPROPERTY(config, EditAnywhere, Category = "GunSettings")
213 FBPVirtualStockSettings VirtualStockSettings;
214
215 // Setting to use for the OneEuro smoothing low pass filter when double gripping something held with a hand
216 UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
217 float OneEuroMinCutoff;
218
219 // Setting to use for the OneEuro smoothing low pass filter when double gripping something held with a hand
220 UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
221 float OneEuroCutoffSlope;
222
223 // Setting to use for the OneEuro smoothing low pass filter when double gripping something held with a hand
224 UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
225 float OneEuroDeltaCutoff;
226
227 // Get the values of the virtual stock settings
228 UFUNCTION(BlueprintCallable, Category = "MeleeSettings")
229 static void GetMeleeSurfaceGlobalSettings(TArray<FBPHitSurfaceProperties>& OutMeleeSurfaceSettings);
230
231 // Get the values of the virtual stock settings
232 UFUNCTION(BlueprintCallable, Category = "GunSettings|VirtualStock")
233 static void GetVirtualStockGlobalSettings(FBPVirtualStockSettings& OutVirtualStockSettings);
235 // Alter the values of the virtual stock settings and save them out
236 UFUNCTION(BlueprintCallable, Category = "GunSettings|VirtualStock")
237 static void SaveVirtualStockGlobalSettings(FBPVirtualStockSettings NewVirtualStockSettings);
238
239
240 DECLARE_MULTICAST_DELEGATE(FVRControllerProfileChangedEvent);
242 FVRControllerProfileChangedEvent OnControllerProfileChangedEvent;
244 // Controller profiles to store related information on a per profile basis
245 UPROPERTY(config, EditAnywhere, Category = "ControllerProfiles")
246 TArray<FBPVRControllerProfile> ControllerProfiles;
247
248 // Store these to save some processing when getting the transform after a profile is loaded
249 FName CurrentControllerProfileInUse;
250 FTransform CurrentControllerProfileTransform;
251 bool bUseSeperateHandTransforms;
252 FTransform CurrentControllerProfileTransformRight;
253
254 // Adjust the transform of a socket for a particular controller model, if a name is not sent in, it will use the currently loaded one
255 // If there is no currently loaded one, it will return the input transform as is.
256 // If bIsRightHand and the target profile uses seperate hand transforms it will use the right hand transform
257 UFUNCTION(BlueprintPure, Category = "VRControllerProfiles")
258 static FTransform AdjustTransformByControllerProfile(FName OptionalControllerProfileName, const FTransform& SocketTransform, bool bIsRightHand = false);
260 // Adjust the transform of a socket for a particular controller model
261 // If there is no currently loaded one, it will return the input transform as is.
262 // If bIsRightHand and the target profile uses seperate hand transforms it will use the right hand transform
263 UFUNCTION(BlueprintPure, Category = "VRControllerProfiles")
264 static FTransform AdjustTransformByGivenControllerProfile(UPARAM(ref) FBPVRControllerProfile& ControllerProfile, const FTransform& SocketTransform, bool bIsRightHand = false);
265
266 // Get array of controller profiles
267 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles")
268 static TArray<FBPVRControllerProfile> GetControllerProfiles();
269
270 // Overwrite a controller profile
271 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles|Operations")
272 static void OverwriteControllerProfile(UPARAM(ref)FBPVRControllerProfile& OverwritingProfile, bool bSaveOutToConfig = true);
273
274 // Add a controller profile
275 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles|Operations")
276 static void AddControllerProfile(UPARAM(ref)FBPVRControllerProfile& NewProfile, bool bSaveOutToConfig = true);
278 // Overwrite a controller profile
279 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles|Operations")
280 static void DeleteControllerProfile(FName ControllerProfileName, bool bSaveOutToConfig = true);
281
282 // Saved the VRGlobalSettings out to its config file, will include any alterations that you made to the profile
283 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles|Operations")
284 static void SaveControllerProfiles();
285
286
287 // Get name of currently loaded profile (if one is loaded)
288 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles")
289 static FName GetCurrentProfileName(bool& bHadLoadedProfile);
290
291 // Get name of currently loaded profile (if one is loaded)
292 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles")
293 static FBPVRControllerProfile GetCurrentProfile(bool& bHadLoadedProfile);
294
295 // Get a controller profile by name
296 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles")
297 static bool GetControllerProfile(FName ControllerProfileName, FBPVRControllerProfile& OutProfile);
298
299 // Load a controller profile by name
300 // Action / Axis mappings overwrite ones with the same action/axis name in the input settings.
301 // If you have an action/axis override but don't assign buttons to it then it will just delete it.
302 // This can be useful for removing actions and using multiple actions (IE: Grip Touch, Grip Vive actions)
303 // For when just changing the buttons isn't good enough
304 // If bSetDefaults is true, will set this as the currently loaded profile
305 // Otherwise will just load it (useful for Left/Right handed profile additions and the like to have it false)
306 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles")
307 static bool LoadControllerProfileByName(FName ControllerProfileName, bool bSetAsCurrentProfile = true);
308
309 // Load a controller profile
310 // Action / Axis mappings overwrite ones with the same action/axis name in the input settings.
311 // If you have an action/axis override but don't assign buttons to it then it will just delete it.
312 // This can be useful for removing actions and using multiple actions (IE: Grip Touch, Grip Vive actions)
313 // For when just changing the buttons isn't good enough
314 // If bSetDefaults is true, will set this as the currently loaded profile
315 // Otherwise will just load it (useful for Left/Right handed profile additions and the like to have it false)
316 // AS OF 4.25 AXIS and ACTION mappings do nothing, will be deleting around 4.26 #TODO: Delete around 4.26
317 UFUNCTION(BlueprintCallable, Category = "VRControllerProfiles")
318 static bool LoadControllerProfile(const FBPVRControllerProfile& ControllerProfile, bool bSetAsCurrentProfile = true);
319
320 virtual void PostInitProperties() override;
321};
DECLARE_MULTICAST_DELEGATE(FOnStaticApexWebSocketConnected)
EVRLerpInterpolationMode
UENUM(BlueprintType)
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent, ChildCanTick), ClassGroup = (VRExpansionPl...
UCLASS(config = Engine, defaultconfig)
float LinearDriveDampingScale
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "ChaosPhysics")
bool bHybridWithSweepUseDistanceBasedLerp
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "HybridWithSweepLerp")
float LerpDuration
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
float AngularDriveDampingScale
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "ChaosPhysics")
TArray< FBPHitSurfaceProperties > MeleeSurfaceSettings
UPROPERTY(config, EditAnywhere, Category = "MeleeSettings")
float OneEuroMinCutoff
UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
FVRControllerProfileChangedEvent OnControllerProfileChangedEvent
int MaxCCDPasses
UPROPERTY(config, EditAnywhere, Category = "Physics")
FBPVirtualStockSettings VirtualStockSettings
UPROPERTY(config, EditAnywhere, Category = "GunSettings")
float HybridWithSweepLerpDuration
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "HybridWithSweepLerp")
bool bLerpHybridWithSweepGrips
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "HybridWithSweepLerp")
float MaxSpeedForLerp
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
float OneEuroDeltaCutoff
UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
TArray< FBPVRControllerProfile > ControllerProfiles
UPROPERTY(config, EditAnywhere, Category = "ControllerProfiles")
float MinSpeedForLerp
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
FRuntimeFloatCurve OptionalCurveToFollow
UPROPERTY(config, Category = "GlobalLerpToHand|Curve", EditAnywhere, meta = (editcondition = "bUseCur...
FTransform CurrentControllerProfileTransform
float MinDistanceForLerp
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
EVRLerpInterpolationMode LerpInterpolationMode
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
float AngularDriveStiffnessScale
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "ChaosPhysics")
bool bUseGlobalLerpToHand
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
TSubclassOf< class UGrippableSkeletalMeshComponent > DefaultGrippableCharacterMeshComponentClass
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "Misc")
float OneEuroCutoffSlope
UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
bool bOnlyLerpHybridRotation
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "HybridWithSweepLerp")
DECLARE_MULTICAST_DELEGATE(FVRControllerProfileChangedEvent)
float LinearDriveStiffnessScale
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "ChaosPhysics")
bool bUseCurve
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand|Curve")
bool bSkipLerpToHandIfHeld
UPROPERTY(config, BlueprintReadWrite, EditAnywhere, Category = "GlobalLerpToHand")
FTransform CurrentControllerProfileTransformRight
USTRUCT(BlueprintType, Category = "Lodging")
Definition GS_Melee.h:75
USTRUCT(BlueprintType, Category = "ControllerProfiles")
FORCEINLINE bool operator==(const FBPVRControllerProfile &Other) const
FBPVRControllerProfile(FName ControllerNameIn, const FTransform &Offset)
FTransform_NetQuantize SocketOffsetTransformRightHand
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ControllerProfiles", meta = (editcondition = ...
FBPVRControllerProfile(FName ControllerNameIn, const FTransform &Offset, const FTransform &OffsetRight)
FBPVRControllerProfile(FName ControllerName)
FName ControllerName
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ControllerProfiles")
FTransform_NetQuantize SocketOffsetTransform
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ControllerProfiles")
bool bUseSeperateHandOffsetTransforms
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ControllerProfiles")
USTRUCT(BlueprintType, Category = "GunSettings")
Definition GS_GunTools.h:22
USTRUCT(BlueprintType, Category = "VRExpansionLibrary|TransformNetQuantize", meta = (HasNativeMake = ...