A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
VRExpansionFunctionLibrary.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4#include "CoreMinimal.h"
5#include "IMotionController.h"
6#include "Kismet/BlueprintFunctionLibrary.h"
7#include "Components/SplineComponent.h"
8#include "Components/SplineMeshComponent.h"
9#include "Components/PrimitiveComponent.h"
10
11//#include "HeadMountedDisplay.h"
12#include "HeadMountedDisplayFunctionLibrary.h"
13//#include "HeadMountedDisplayFunctionLibrary.h"
14#include "IHeadMountedDisplay.h"
16
17#include "VRBPDatatypes.h"
18#include "GameplayTagContainer.h"
19#include "XRMotionControllerBase.h" // for GetHandEnumForSourceName()
20
21#include "VRExpansionFunctionLibrary.generated.h"
22
23//General Advanced Sessions Log
24DECLARE_LOG_CATEGORY_EXTERN(VRExpansionFunctionLibraryLog, Log, All);
25
30UENUM(BlueprintType)
31enum class EBPHMDWornState : uint8
32{
33 Unknown UMETA(DisplayName = "Unknown"),
34 Worn UMETA(DisplayName = "Worn"),
35 NotWorn UMETA(DisplayName = "Not Worn"),
36};
37
38UCLASS()//, meta = (BlueprintSpawnableComponent))
39class VREXPANSIONPLUGIN_API UVRExpansionFunctionLibrary : public UBlueprintFunctionLibrary
40{
41 //GENERATED_BODY()
42 GENERATED_BODY()
43 //~UVRExpansionFunctionLibrary();
44public:
45
46 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (WorldContext = "WorldContextObject", CallableWithoutWorldContext))
47 static UGameViewportClient * GetGameViewportClient(UObject* WorldContextObject);
48
49
50 // Sets two primitive components to ignore collision between two specific bodies
51 // If bAddChildBones is true then it will also add all child bones of the given bone (or the entire skeleton if no name is given)
52 UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions|Collision", meta = (bIgnoreSelf = "true", WorldContext = "WorldContextObject", CallableWithoutWorldContext))
53 static void SetObjectsIgnoreCollision(UObject* WorldContextObject, UPrimitiveComponent* Prim1 = nullptr, FName OptionalBoneName1 = NAME_None, bool bAddChildBones1 = false, UPrimitiveComponent* Prim2 = nullptr, FName OptionalBoneName2 = NAME_None, bool bAddChildBones2 = false, bool bIgnoreCollision = true);
54
55 // Sets two actors to entirely ignore collision between them
56 UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions|Collision", meta = (bIgnoreSelf = "true", WorldContext = "WorldContextObject", CallableWithoutWorldContext))
57 static void SetActorsIgnoreAllCollision(UObject* WorldContextObject, AActor* Actor1 = nullptr, AActor* Actor2 = nullptr, bool bIgnoreCollision = true);
58
59 // Removes all collision ignore matches for the given primitive object
60 UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions|Collision", meta = (bIgnoreSelf = "true", WorldContext = "WorldContextObject", CallableWithoutWorldContext))
61 static void RemoveObjectCollisionIgnore(UObject* WorldContextObject, UPrimitiveComponent* Prim1);
62
63 // Removes all collision ignore matches for the given actor
64 UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions|Collision", meta = (bIgnoreSelf = "true", WorldContext = "WorldContextObject", CallableWithoutWorldContext))
65 static void RemoveActorCollisionIgnore(UObject* WorldContextObject, AActor* Actor1);
66
67 // Returns if the component is ignoring any collisions
68 UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions|Collision", meta = (bIgnoreSelf = "true", WorldContext = "WorldContextObject", CallableWithoutWorldContext))
69 static bool IsComponentIgnoringCollision(UObject* WorldContextObject, UPrimitiveComponent* Prim1);
70
71 // Returns if the component is ignoring collisions with the specific component
72 // This does not check per bone, but rather at scale if any part of them are ignoring each other
73 UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions|Collision", meta = (bIgnoreSelf = "true", WorldContext = "WorldContextObject", CallableWithoutWorldContext))
74 static bool AreComponentsIgnoringCollisions(UObject* WorldContextObject, UPrimitiveComponent* Prim1, UPrimitiveComponent* Prim2);
75
76 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "GetHandFromMotionSourceName"))
77 static bool GetHandFromMotionSourceName(FName MotionSource, EControllerHand& Hand)
78 {
79 Hand = EControllerHand::Left;
80 if (FXRMotionControllerBase::GetHandEnumForSourceName(MotionSource, Hand))
81 {
82 return true;
83 }
84
85 return false;
86 }
87
88 // Gets the unwound yaw of the HMD
89 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "GetHMDPureYaw"))
90 static FRotator GetHMDPureYaw(FRotator HMDRotation);
91
92 inline static FRotator GetHMDPureYaw_I(FRotator HMDRotation)
93 {
94 // Took this from UnityVRToolkit, no shame, I liked it
95 FRotationMatrix HeadMat(HMDRotation);
96 FVector forward = HeadMat.GetScaledAxis(EAxis::X);
97 FVector forwardLeveled = forward;
98 forwardLeveled.Z = 0;
99 forwardLeveled.Normalize();
100 FVector mixedInLocalForward = HeadMat.GetScaledAxis(EAxis::Z);
101
102 if (forward.Z > 0)
103 {
104 mixedInLocalForward = -mixedInLocalForward;
105 }
107 mixedInLocalForward.Z = 0;
108 mixedInLocalForward.Normalize();
109 float dot = FMath::Clamp(FVector::DotProduct(forwardLeveled, forward), 0.0f, 1.0f);
110 FVector finalForward = FMath::Lerp(mixedInLocalForward, forwardLeveled, dot * dot);
111
112 return FRotationMatrix::MakeFromXZ(finalForward, FVector::UpVector).Rotator();
113 }
114
115 // Applies a delta rotation around a pivot point, if bUseOriginalYawOnly is true then it only takes the original Yaw into account (characters)
116 UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "RotateAroundPivot"))
117 static void RotateAroundPivot(FRotator RotationDelta, FVector OriginalLocation, FRotator OriginalRotation, FVector PivotPoint, FVector & NewLocation, FRotator & NewRotation,bool bUseOriginalYawOnly = true)
118 {
119 if (bUseOriginalYawOnly)
120 {
121 // Keep original pitch/roll
122 NewRotation.Pitch = OriginalRotation.Pitch;
123 NewRotation.Roll = OriginalRotation.Roll;
125 // Throw out pitch/roll before calculating offset
126 OriginalRotation.Roll = 0;
127 OriginalRotation.Pitch = 0;
128
129 // Offset to pivot point
130 NewLocation = OriginalLocation + OriginalRotation.RotateVector(PivotPoint);
131
132 // Combine rotations
133 OriginalRotation.Yaw = (OriginalRotation.Quaternion() * RotationDelta.Quaternion()).Rotator().Yaw;
134 NewRotation.Yaw = OriginalRotation.Yaw;
135
136 // Remove pivot point offset
137 NewLocation -= OriginalRotation.RotateVector(PivotPoint);
138
139 }
140 else
141 {
142 NewLocation = OriginalLocation + OriginalRotation.RotateVector(PivotPoint);
143 NewRotation = (OriginalRotation.Quaternion() * RotationDelta.Quaternion()).Rotator();
144 NewLocation -= NewRotation.RotateVector(PivotPoint);
145 }
146 }
147
148 // Returns a delta rotation to have Vec1 point towards Vec2, assumes that the v
149 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "FindBetween"))
150 static FRotator BPQuat_FindBetween(FVector Vec1, FVector Vec2)
151 {
152 return FQuat::FindBetween(Vec1, Vec2).Rotator();
153 }
154
155 // Gets whether an HMD device is connected
156 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "GetIsHMDConnected"))
157 static bool GetIsHMDConnected();
158
159 // Gets whether an HMD device is connected
160 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "GetIsHMDWorn"))
161 static EBPHMDWornState GetIsHMDWorn();
162
163 // Gets whether an HMD device is connected
164 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "GetHMDType"))
165 static EBPHMDDeviceType GetHMDType();
166
167 // Gets whether the game is running in VRPreview or is a non editor build game (returns true for either).
168 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "IsInVREditorPreviewOrGame"))
169 static bool IsInVREditorPreviewOrGame();
170
171 // Gets whether the game is running in VRPreview
172 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "IsInVREditorPreview"))
173 static bool IsInVREditorPreview();
174
185 UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions", meta = (WorldContext = "WorldContextObject", CallableWithoutWorldContext))
186 static void NonAuthorityMinimumAreaRectangle(UObject* WorldContextObject, const TArray<FVector>& InVerts, const FVector& SampleSurfaceNormal, FVector& OutRectCenter, FRotator& OutRectRotation, float& OutSideLengthX, float& OutSideLengthY, bool bDebugDraw = false);
187
188 // A Rolling average low pass filter
189 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "LowPassFilter_RollingAverage"))
190 static void LowPassFilter_RollingAverage(FVector lastAverage, FVector newSample, FVector & newAverage, int32 numSamples = 10);
191
192 // A exponential low pass filter
193 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "LowPassFilter_Exponential"))
194 static void LowPassFilter_Exponential(FVector lastAverage, FVector newSample, FVector & newAverage, float sampleFactor = 0.25f);
195
196 // Gets whether an HMD device is connected
197 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true", DisplayName = "GetIsActorMovable"))
198 static bool GetIsActorMovable(AActor * ActorToCheck);
199
200 // Gets if an actors root component contains a grip slot within range
201 UFUNCTION(BlueprintPure, Category = "VRGrip", meta = (bIgnoreSelf = "true", DisplayName = "GetGripSlotInRangeByTypeName"))
202 static void GetGripSlotInRangeByTypeName(FName SlotType, AActor * Actor, FVector WorldLocation, float MaxRange, bool & bHadSlotInRange, FTransform & SlotWorldTransform, FName & SlotName, UGripMotionControllerComponent* QueryController = nullptr);
203
204 // Gets if an actors root component contains a grip slot within range
205 UFUNCTION(BlueprintPure, Category = "VRGrip", meta = (bIgnoreSelf = "true", DisplayName = "GetGripSlotInRangeByTypeName_Component"))
206 static void GetGripSlotInRangeByTypeName_Component(FName SlotType, USceneComponent * Component, FVector WorldLocation, float MaxRange, bool & bHadSlotInRange, FTransform & SlotWorldTransform, FName & SlotName, UGripMotionControllerComponent* QueryController = nullptr);
207
208 /* Returns true if the values are equal (A == B) */
209 UFUNCTION(BlueprintPure, meta = (DisplayName = "Equal VR Grip", CompactNodeTitle = "==", Keywords = "== equal"), Category = "VRExpansionFunctions")
210 static bool EqualEqual_FBPActorGripInformation(const FBPActorGripInformation &A, const FBPActorGripInformation &B);
211
212 /* Returns true if the grip is active (both valid and not paused) */
213 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions")
214 static bool IsActiveGrip(const FBPActorGripInformation& Grip);
215
216
218 UFUNCTION(BlueprintPure, meta = (Scale = "1,1,1", Keywords = "construct build", NativeMakeFunc), Category = "VRExpansionLibrary|TransformNetQuantize")
219 static FTransform_NetQuantize MakeTransform_NetQuantize(FVector Location, FRotator Rotation, FVector Scale);
220
222 UFUNCTION(BlueprintPure, Category = "VRExpansionLibrary|TransformNetQuantize", meta = (NativeBreakFunc))
223 static void BreakTransform_NetQuantize(const FTransform_NetQuantize& InTransform, FVector& Location, FRotator& Rotation, FVector& Scale);
224
226 UFUNCTION(BlueprintPure, meta = (DisplayName = "ToTransform_NetQuantize (Transform)", CompactNodeTitle = "->", BlueprintAutocast), Category = "VRExpansionLibrary|TransformNetQuantize")
227 static FTransform_NetQuantize Conv_TransformToTransformNetQuantize(const FTransform &InTransform);
228
230 UFUNCTION(BlueprintPure, meta = (DisplayName = "ToVector_NetQuantize (Vector)", CompactNodeTitle = "->", BlueprintAutocast), Category = "VRExpansionLibrary|FVectorNetQuantize")
231 static FVector_NetQuantize Conv_FVectorToFVectorNetQuantize(const FVector &InVector);
232
234 UFUNCTION(BlueprintPure, meta = (Scale = "1,1,1", Keywords = "construct build", NativeMakeFunc), Category = "VRExpansionLibrary|FVectorNetQuantize")
235 static FVector_NetQuantize MakeVector_NetQuantize(FVector InVector);
236
238 UFUNCTION(BlueprintPure, meta = (DisplayName = "ToVector_NetQuantize10 (Vector)", CompactNodeTitle = "->", BlueprintAutocast), Category = "VRExpansionLibrary|FVectorNetQuantize")
239 static FVector_NetQuantize10 Conv_FVectorToFVectorNetQuantize10(const FVector &InVector);
240
242 UFUNCTION(BlueprintPure, meta = (Scale = "1,1,1", Keywords = "construct build", NativeMakeFunc), Category = "VRExpansionLibrary|FVectorNetQuantize")
243 static FVector_NetQuantize10 MakeVector_NetQuantize10(FVector InVector);
244
246 UFUNCTION(BlueprintPure, meta = (DisplayName = "ToVector_NetQuantize100 (Vector)", CompactNodeTitle = "->", BlueprintAutocast), Category = "VRExpansionLibrary|FVectorNetQuantize")
247 static FVector_NetQuantize100 Conv_FVectorToFVectorNetQuantize100(const FVector &InVector);
248
250 UFUNCTION(BlueprintPure, meta = (Scale = "1,1,1", Keywords = "construct build", NativeMakeFunc), Category = "VRExpansionLibrary|FVectorNetQuantize")
251 static FVector_NetQuantize100 MakeVector_NetQuantize100(FVector InVector);
252
254 UFUNCTION(BlueprintPure, meta = (DisplayName = "ToController (FBPGripPair)", CompactNodeTitle = "->", BlueprintAutocast), Category = "VRExpansionLibrary")
255 static UGripMotionControllerComponent * Conv_GripPairToMotionController(const FBPGripPair &GripPair);
256
258 UFUNCTION(BlueprintPure, meta = (DisplayName = "ToGripID (FBPGripPair)", CompactNodeTitle = "->", BlueprintAutocast), Category = "VRExpansionLibrary")
259 static uint8 Conv_GripPairToGripID(const FBPGripPair &GripPair);
260
261 // Adds a USceneComponent Subclass, that is based on the passed in Class, and added to the Outer(Actor) object
262 UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Scene Component By Class"), Category = "VRExpansionLibrary")
263 static USceneComponent* AddSceneComponentByClass(UObject* Outer, TSubclassOf<USceneComponent> Class, const FTransform & ComponentRelativeTransform);
264
265
267 UFUNCTION(BlueprintCallable, Category = "LowPassFilter_Peak")
268 static void ResetPeakLowPassFilter(UPARAM(ref) FBPLowPassPeakFilter& TargetPeakFilter)
269 {
270 TargetPeakFilter.Reset();
271 }
272
274 UFUNCTION(BlueprintCallable, Category = "LowPassFilter_Peak")
275 static void UpdatePeakLowPassFilter(UPARAM(ref) FBPLowPassPeakFilter& TargetPeakFilter, FVector NewSample)
276 {
277 TargetPeakFilter.AddSample(NewSample);
278 }
279
281 UFUNCTION(BlueprintCallable, Category = "LowPassFilter_Peak")
282 static FVector GetPeak_PeakLowPassFilter(UPARAM(ref) FBPLowPassPeakFilter& TargetPeakFilter)
283 {
284 return TargetPeakFilter.GetPeak();
285 }
286
287
289 UFUNCTION(BlueprintCallable, Category = "EuroLowPassFilter")
290 static void ResetEuroSmoothingFilter(UPARAM(ref) FBPEuroLowPassFilter& TargetEuroFilter)
291 {
292 TargetEuroFilter.ResetSmoothingFilter();
293 }
294
296 UFUNCTION(BlueprintCallable, Category = "EuroLowPassFilter")
297 static void RunEuroSmoothingFilter(UPARAM(ref) FBPEuroLowPassFilter& TargetEuroFilter, FVector InRawValue, const float DeltaTime, FVector & SmoothedValue)
298 {
299 SmoothedValue = TargetEuroFilter.RunFilterSmoothing(InRawValue, DeltaTime);
300 }
301
302 // Applies the same laser smoothing that the vr editor uses to an array of points
303 UFUNCTION(BlueprintCallable, meta = (DisplayName = "Smooth Update Laser Spline"), Category = "VRExpansionLibrary")
304 static void SmoothUpdateLaserSpline(USplineComponent * LaserSplineComponent, TArray<USplineMeshComponent *> LaserSplineMeshComponents, FVector InStartLocation, FVector InEndLocation, FVector InForward, float LaserRadius)
305 {
306 if (LaserSplineComponent == nullptr)
307 return;
308
309 LaserSplineComponent->ClearSplinePoints();
310
311 const FVector SmoothLaserDirection = InEndLocation - InStartLocation;
312 float Distance = SmoothLaserDirection.Size();
313 const FVector StraightLaserEndLocation = InStartLocation + (InForward * Distance);
314 const int32 NumLaserSplinePoints = LaserSplineMeshComponents.Num();
315
316 LaserSplineComponent->AddSplinePoint(InStartLocation, ESplineCoordinateSpace::World, false);
317 for (int32 Index = 1; Index < NumLaserSplinePoints; Index++)
318 {
319 float Alpha = (float)Index / (float)NumLaserSplinePoints;
320 Alpha = FMath::Sin(Alpha * PI * 0.5f);
321 const FVector PointOnStraightLaser = FMath::Lerp(InStartLocation, StraightLaserEndLocation, Alpha);
322 const FVector PointOnSmoothLaser = FMath::Lerp(InStartLocation, InEndLocation, Alpha);
323 const FVector PointBetweenLasers = FMath::Lerp(PointOnStraightLaser, PointOnSmoothLaser, Alpha);
324 LaserSplineComponent->AddSplinePoint(PointBetweenLasers, ESplineCoordinateSpace::World, false);
325 }
326 LaserSplineComponent->AddSplinePoint(InEndLocation, ESplineCoordinateSpace::World, false);
327
328 // Update all the segments of the spline
329 LaserSplineComponent->UpdateSpline();
330
331 const float LaserPointerRadius = LaserRadius;
332 Distance *= 0.0001f;
333 for (int32 Index = 0; Index < NumLaserSplinePoints; Index++)
334 {
335 USplineMeshComponent* SplineMeshComponent = LaserSplineMeshComponents[Index];
336 check(SplineMeshComponent != nullptr);
337
338 FVector StartLoc, StartTangent, EndLoc, EndTangent;
339 LaserSplineComponent->GetLocationAndTangentAtSplinePoint(Index, StartLoc, StartTangent, ESplineCoordinateSpace::Local);
340 LaserSplineComponent->GetLocationAndTangentAtSplinePoint(Index + 1, EndLoc, EndTangent, ESplineCoordinateSpace::Local);
341
342 const float AlphaIndex = (float)Index / (float)NumLaserSplinePoints;
343 const float AlphaDistance = Distance * AlphaIndex;
344 float Radius = LaserPointerRadius * ((AlphaIndex * AlphaDistance) + 1);
345 FVector2D LaserScale(Radius, Radius);
346 SplineMeshComponent->SetStartScale(LaserScale, false);
347
348 const float NextAlphaIndex = (float)(Index + 1) / (float)NumLaserSplinePoints;
349 const float NextAlphaDistance = Distance * NextAlphaIndex;
350 Radius = LaserPointerRadius * ((NextAlphaIndex * NextAlphaDistance) + 1);
351 LaserScale = FVector2D(Radius, Radius);
352 SplineMeshComponent->SetEndScale(LaserScale, false);
353
354 SplineMeshComponent->SetStartAndEnd(StartLoc, StartTangent, EndLoc, EndTangent, true);
355 }
356
357 }
358
368 UFUNCTION(BlueprintPure, Category = "GameplayTags")
369 static bool MatchesAnyTagsWithDirectParentTag(FGameplayTag DirectParentTag,const FGameplayTagContainer& BaseContainer, const FGameplayTagContainer& OtherContainer)
370 {
371 TArray<FGameplayTag> BaseContainerTags;
372 BaseContainer.GetGameplayTagArray(BaseContainerTags);
373
374 for (const FGameplayTag& OtherTag : BaseContainerTags)
375 {
376 if (OtherTag.RequestDirectParent().MatchesTagExact(DirectParentTag))
377 {
378 if (OtherContainer.HasTagExact(OtherTag))
379 return true;
380 }
381 }
382
383 return false;
385
393 UFUNCTION(BlueprintPure, Category = "GameplayTags")
394 static bool GetFirstGameplayTagWithExactParent(FGameplayTag DirectParentTag, const FGameplayTagContainer& BaseContainer, FGameplayTag& FoundTag)
395 {
396 TArray<FGameplayTag> BaseContainerTags;
397 BaseContainer.GetGameplayTagArray(BaseContainerTags);
398
399 for (const FGameplayTag& OtherTag : BaseContainerTags)
400 {
401 if (OtherTag.RequestDirectParent().MatchesTagExact(DirectParentTag))
402 {
403 FoundTag = OtherTag;
404 return true;
405 }
406 }
407
408 return false;
409 }
410
411 // #TODO: probably need to implement this some day
412 // This doesn't work for the web browser widget but it does for the normal widgets like text boxes
413 // Just have to SetKeyboardFocus or SetUserFocus for the input widget first
414 // Main problem is it takes focus from the player then....
415 /*UFUNCTION(BlueprintCallable, Category = "KeyboardSimulation")
416 static void SimulateCharacterEntry(UPARAM(ref) const FString& InChar)
417 {
418
419 for (int32 CharIndex = 0; CharIndex < InChar.Len(); CharIndex++)
420 {
421 TCHAR CharKey = InChar[CharIndex];
422 const bool bRepeat = false;
423 FCharacterEvent CharacterEvent(CharKey, FModifierKeysState(), 0, bRepeat);
424 FSlateApplication::Get().ProcessKeyCharEvent(CharacterEvent);
426
427 }*/
428 /*
429 void FVREditorActionCallbacks::SimulateBackspace()
430 {
431 // Slate editable text fields handle backspace as a character entry
432 FString BackspaceString = FString(TEXT("\b"));
433 bool bRepeat = false;
434 SimulateCharacterEntry(BackspaceString);
436
437 void FVREditorActionCallbacks::SimulateKeyDown(const FKey Key, const bool bRepeat)
438 {
439 const uint32* KeyCodePtr;
440 const uint32* CharCodePtr;
441 FInputKeyManager::Get().GetCodesFromKey(Key, KeyCodePtr, CharCodePtr);
442
443 uint32 KeyCode = KeyCodePtr ? *KeyCodePtr : 0;
444 uint32 CharCode = CharCodePtr ? *CharCodePtr : 0;
445
446 FKeyEvent KeyEvent(Key, FModifierKeysState(), 0, bRepeat, KeyCode, CharCode);
447 bool DownResult = FSlateApplication::Get().ProcessKeyDownEvent(KeyEvent);
448
449 if (CharCodePtr)
450 {
451 FCharacterEvent CharacterEvent(CharCode, FModifierKeysState(), 0, bRepeat);
452 FSlateApplication::Get().ProcessKeyCharEvent(CharacterEvent);
453 }
454 }
455
456 void FVREditorActionCallbacks::SimulateKeyUp(const FKey Key)
457 {
458 const uint32* KeyCodePtr;
459 const uint32* CharCodePtr;
460 FInputKeyManager::Get().GetCodesFromKey(Key, KeyCodePtr, CharCodePtr);
461
462 uint32 KeyCode = KeyCodePtr ? *KeyCodePtr : 0;
463 uint32 CharCode = CharCodePtr ? *CharCodePtr : 0;
464
465 FKeyEvent KeyEvent(Key, FModifierKeysState(), 0, false, KeyCode, CharCode);
466 FSlateApplication::Get().ProcessKeyUpEvent(KeyEvent);
467 }*/
468};
469
470
EBPHMDDeviceType
UENUM(Blueprintable)
DECLARE_LOG_CATEGORY_EXTERN(VRExpansionFunctionLibraryLog, Log, All)
EBPHMDWornState
UENUM(BlueprintType)
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = MotionController)
static void RotateAroundPivot(FRotator RotationDelta, FVector OriginalLocation, FRotator OriginalRotation, FVector PivotPoint, FVector &NewLocation, FRotator &NewRotation, bool bUseOriginalYawOnly=true)
UFUNCTION(BlueprintCallable, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true",...
static FVector GetPeak_PeakLowPassFilter(UPARAM(ref) FBPLowPassPeakFilter &TargetPeakFilter)
UFUNCTION(BlueprintCallable, Category = "LowPassFilter_Peak")
static void ResetPeakLowPassFilter(UPARAM(ref) FBPLowPassPeakFilter &TargetPeakFilter)
UFUNCTION(BlueprintCallable, Category = "LowPassFilter_Peak")
static void UpdatePeakLowPassFilter(UPARAM(ref) FBPLowPassPeakFilter &TargetPeakFilter, FVector NewSample)
UFUNCTION(BlueprintCallable, Category = "LowPassFilter_Peak")
static void ResetEuroSmoothingFilter(UPARAM(ref) FBPEuroLowPassFilter &TargetEuroFilter)
UFUNCTION(BlueprintCallable, Category = "EuroLowPassFilter")
static bool GetHandFromMotionSourceName(FName MotionSource, EControllerHand &Hand)
UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true",...
static bool MatchesAnyTagsWithDirectParentTag(FGameplayTag DirectParentTag, const FGameplayTagContainer &BaseContainer, const FGameplayTagContainer &OtherContainer)
UFUNCTION(BlueprintPure, Category = "GameplayTags")
static bool GetFirstGameplayTagWithExactParent(FGameplayTag DirectParentTag, const FGameplayTagContainer &BaseContainer, FGameplayTag &FoundTag)
UFUNCTION(BlueprintPure, Category = "GameplayTags")
static void SmoothUpdateLaserSpline(USplineComponent *LaserSplineComponent, TArray< USplineMeshComponent * > LaserSplineMeshComponents, FVector InStartLocation, FVector InEndLocation, FVector InForward, float LaserRadius)
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Smooth Update Laser Spline"), Category = "VRExpan...
static FRotator BPQuat_FindBetween(FVector Vec1, FVector Vec2)
UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true",...
static void RunEuroSmoothingFilter(UPARAM(ref) FBPEuroLowPassFilter &TargetEuroFilter, FVector InRawValue, const float DeltaTime, FVector &SmoothedValue)
UFUNCTION(BlueprintCallable, Category = "EuroLowPassFilter")
static FRotator GetHMDPureYaw_I(FRotator HMDRotation)
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
USTRUCT(BlueprintType, Category = "VRExpansionLibrary|TransformNetQuantize", meta = (HasNativeMake = ...