A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
GS_GunTools.cpp
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
4#include "VRGripInterface.h"
7#include "IXRTrackingSystem.h"
8#include "VRGlobalSettings.h"
9#include "VRBaseCharacter.h"
10#include "DrawDebugHelpers.h"
11
12UGS_GunTools::UGS_GunTools(const FObjectInitializer& ObjectInitializer) :
13 Super(ObjectInitializer)
14{
15 bIsActive = true;
17 PivotOffset = FVector::ZeroVector;
18 VirtualStockComponent = nullptr;
19 MountWorldTransform = FTransform::Identity;
20 //StockSnapOffset = FVector(0.f, 0.f, 0.f);
21 bIsMounted = false;
22
23
24 bHasRecoil = false;
26 MaxRecoilTranslation = FVector::ZeroVector;
27 MaxRecoilRotation = FVector::ZeroVector;
28 MaxRecoilScale = FVector(1.f);
29 bHasActiveRecoil = false;
30 DecayRate = 20.f;
31 LerpRate = 30.f;
32
33 BackEndRecoilStorage = FTransform::Identity;
34
36
38
40 //bInjectPostPhysicsHandle = true;
42 OrientationComponentRelativeFacing = FTransform::Identity;
43 StoredRootOffset = FQuat::Identity;
44}
45
47{
48 // Grip base has no super of this
49
51 {
52 if (AActor * Owner = GetOwner())
53 {
54 FName CurrentCompName = NAME_None;
55 for (UActorComponent* ChildComp : Owner->GetComponents())
56 {
57 CurrentCompName = ChildComp->GetFName();
58 if (CurrentCompName == NAME_None)
59 continue;
60
61 if (CurrentCompName == WeaponRootOrientationComponent)
62 {
63 if (USceneComponent * SceneComp = Cast<USceneComponent>(ChildComp))
64 {
65 OrientationComponentRelativeFacing = SceneComp->GetRelativeTransform();
66 }
67
68 break;
69 }
70 }
71 }
72 }
73}
74
76{
77 if (!bIsActive)
78 return;
79
80 if (WeaponRootOrientationComponent != NAME_None)
81 {
82 StoredRootOffset = HandleInfo->RootBoneRotation.GetRotation().Inverse() * OrientationComponentRelativeFacing.GetRotation();
83
84 // Alter to rotate to x+ if we have an orientation component
85 FQuat DeltaQuat = OrientationComponentRelativeFacing.GetRotation();
86
87 KinPose.SetRotation(KinPose.GetRotation() * StoredRootOffset);
88 HandleInfo->COMPosition.SetRotation(HandleInfo->COMPosition.GetRotation() * StoredRootOffset);
89 }
90 else
91 {
92 StoredRootOffset = FQuat::Identity;
93 }
94
95 if (GripInfo.bIsSlotGrip && !PivotOffset.IsZero())
96 {
97 KinPose.SetLocation(KinPose.TransformPosition(PivotOffset));
98 HandleInfo->COMPosition.SetLocation(HandleInfo->COMPosition.TransformPosition(PivotOffset));
99 }
100}
101
102/*void UGS_GunTools::HandlePostPhysicsHandle(UGripMotionControllerComponent* GrippingController, FBPActorPhysicsHandleInformation* HandleInfo)
103{
104}*/
105
107(
108 UGripMotionControllerComponent* GrippingController,
109 float DeltaTime, FTransform & WorldTransform,
110 const FTransform &ParentTransform,
112 AActor * actor,
113 UPrimitiveComponent * root,
114 bool bRootHasInterface,
115 bool bActorHasInterface,
116 bool bIsForTeleport
117)
118{
119 if (!GrippingController)
120 return false;
121
122 bool bSkipHighQualityOperations = !bUseHighQualityRemoteSimulation && !GrippingController->bHasAuthority;
123
124 /*if (!GunViewExtension.IsValid() && GEngine)
125 {
126 GunViewExtension = FSceneViewExtensions::NewExtension<FGunViewExtension>(GrippingController);
127 }*/
128
129 // Just simple transform setting
131 {
132 BackEndRecoilStorage.Blend(BackEndRecoilStorage, BackEndRecoilTarget, FMath::Clamp(LerpRate * DeltaTime, 0.f, 1.f));
133 BackEndRecoilTarget.Blend(BackEndRecoilTarget, FTransform::Identity, FMath::Clamp(DecayRate * DeltaTime, 0.f, 1.f));
134 bHasActiveRecoil = !BackEndRecoilTarget.Equals(FTransform::Identity);
135
136 if (!bHasActiveRecoil)
137 {
138 BackEndRecoilStorage.SetIdentity();
139 BackEndRecoilTarget.SetIdentity();
140 }
141 }
142
144 {
145 // Using a matrix to avoid FTransform inverse math issues
146 FTransform relTransform(Grip.RelativeTransform.ToInverseMatrixWithScale());
147
148 // Eventually may want to adjust the pivot of the recoil rotation by the PivotOffset vector...
149 FVector Pivot = relTransform.GetLocation() + PivotOffset;
150 const FTransform PivotToWorld = FTransform(FQuat::Identity, Pivot);
151 const FTransform WorldToPivot = FTransform(FQuat::Identity, -Pivot);
152
153 WorldTransform = WorldToPivot * BackEndRecoilStorage * PivotToWorld * Grip.RelativeTransform * Grip.AdditionTransform * ParentTransform;
154 }
155 else
156 WorldTransform = Grip.RelativeTransform * Grip.AdditionTransform * ParentTransform;
157
158 // Check the grip lerp state, this it ouside of the secondary attach check below because it can change the result of it
160 {
161 if (!bSkipHighQualityOperations && bUseVirtualStock)
162 {
163 if (VirtualStockComponent.IsValid())
164 {
165 FRotator PureYaw = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(VirtualStockComponent->GetComponentRotation());
166 MountWorldTransform = FTransform(PureYaw.Quaternion(), VirtualStockComponent->GetComponentLocation() + PureYaw.RotateVector(VirtualStockSettings.StockSnapOffset));
167 }
168 else if (GrippingController->bHasAuthority && GEngine->XRSystem.IsValid() && GEngine->XRSystem->IsHeadTrackingAllowedForWorld(*GetWorld()))
169 {
170 FQuat curRot = FQuat::Identity;
171 FVector curLoc = FVector::ZeroVector;
172
173 if (GEngine->XRSystem->GetCurrentPose(IXRTrackingSystem::HMDDeviceId, curRot, curLoc))
174 {
175 // Translate hmd offset by the gripping controllers parent component, this should be in the same space
176 FRotator PureYaw = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(curRot.Rotator());
177 MountWorldTransform = FTransform(PureYaw.Quaternion(), curLoc + PureYaw.RotateVector(VirtualStockSettings.StockSnapOffset)) * GrippingController->GetAttachParent()->GetComponentTransform();
178 }
179 }
180 else if(CameraComponent.IsValid())
181 {
182 FRotator PureYaw = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(CameraComponent->GetComponentRotation());
183 MountWorldTransform = FTransform(PureYaw.Quaternion(), CameraComponent->GetComponentLocation() + PureYaw.RotateVector(VirtualStockSettings.StockSnapOffset));
184 }
185
186 float StockSnapDistance = FMath::Square(VirtualStockSettings.StockSnapDistance);
187 float DistSquared = FVector::DistSquared(ParentTransform.GetTranslation(), MountWorldTransform.GetTranslation());
188
189 if (DistSquared <= StockSnapDistance)
190 {
191
192 float StockSnapLerpThresh = FMath::Square(VirtualStockSettings.StockSnapLerpThreshold);
193
194 if (StockSnapLerpThresh > 0.0f)
195 VirtualStockSettings.StockLerpValue = 1.0f - FMath::Clamp((DistSquared - (StockSnapDistance - StockSnapLerpThresh)) / StockSnapLerpThresh, 0.0f, 1.0f);
196 else
197 VirtualStockSettings.StockLerpValue = 1.0f; // Just skip lerping logic
198
199 if (!bIsMounted)
200 {
202
203 // Mount up
204 bIsMounted = true;
206 }
207
208 // Adjust the mount location to follow the Z of the primary hand
210 {
211 FVector WorldTransVec = MountWorldTransform.GetTranslation();
212
213 if (WorldTransVec.Z >= ParentTransform.GetTranslation().Z)
214 {
215 WorldTransVec.Z = ParentTransform.GetTranslation().Z;
216 MountWorldTransform.SetLocation(WorldTransVec);
217 }
218 }
219
220#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
222 {
223 DrawDebugLine(GetWorld(), ParentTransform.GetTranslation(), MountWorldTransform.GetTranslation(), FColor::Red);
224 DrawDebugLine(GetWorld(), Grip.SecondaryGripInfo.SecondaryAttachment->GetComponentLocation(), MountWorldTransform.GetTranslation(), FColor::Green);
225 DrawDebugSphere(GetWorld(), MountWorldTransform.GetTranslation(), 10.f, 32, FColor::White);
226 }
227#endif
228 }
229 else
230 {
231 if (bIsMounted)
232 {
233 bIsMounted = false;
236 }
237 }
238 }
239 }
240 else
241 {
242 if (bIsMounted)
243 {
244 bIsMounted = false;
247 }
248 }
249
250 // Check the grip lerp state, this it ouside of the secondary attach check below because it can change the result of it
252 {
253 switch (Grip.SecondaryGripInfo.GripLerpState)
254 {
257 {
258 if (Grip.SecondaryGripInfo.curLerp > 0.01f)
259 Grip.SecondaryGripInfo.curLerp -= DeltaTime;
260 else
261 {
263 }
264
265 }break;
266 //case EGripLerpState::ConstantLerp_DEPRECATED:
268 default:break;
269 }
270 }
271
272 // Handle the interp and multi grip situations, re-checking the grip situation here as it may have changed in the switch above.
274 {
275 FTransform NewWorldTransform = WorldTransform;
276 FTransform SecondaryTransform = Grip.RelativeTransform * ParentTransform;
277
278 // Checking secondary grip type for the scaling setting
280
281 if (bRootHasInterface)
282 SecondaryType = IVRGripInterface::Execute_SecondaryGripType(root);
283 else if (bActorHasInterface)
284 SecondaryType = IVRGripInterface::Execute_SecondaryGripType(actor);
285
286 // If the grip is a custom one, skip all of this logic we won't be changing anything
287 if (SecondaryType != ESecondaryGripType::SG_Custom)
288 {
289 // Variables needed for multi grip transform
290 FVector BasePoint = ParentTransform.GetLocation();
291 FVector Pivot = ParentTransform.GetLocation();
292
293 if (Grip.bIsSlotGrip)
294 {
295 if (FBPActorPhysicsHandleInformation * PhysHandle = GrippingController->GetPhysicsGrip(Grip))
296 {
297 Pivot = SecondaryTransform.TransformPositionNoScale(SecondaryTransform.InverseTransformPositionNoScale(Pivot) + (StoredRootOffset * PhysHandle->RootBoneRotation.GetRotation()).RotateVector(PivotOffset));
298 }
299 else
300 {
301 Pivot = SecondaryTransform.TransformPositionNoScale(SecondaryTransform.InverseTransformPositionNoScale(Pivot) + OrientationComponentRelativeFacing.GetRotation().RotateVector(PivotOffset));
302 }
303 }
304
305 // Debug draw for COM movement with physics grips
306#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
307 static const auto CVarDrawCOMDebugSpheresAccess = IConsoleManager::Get().FindConsoleVariable(TEXT("vr.DrawDebugCenterOfMassForGrips"));
308 if (CVarDrawCOMDebugSpheresAccess->GetInt() > 0)
309 {
310 DrawDebugSphere(GetWorld(), Pivot, 5, 32, FColor::Orange, false);
311 }
312#endif
313
314 const FTransform PivotToWorld = FTransform(FQuat::Identity, Pivot);//BasePoint);
315 const FTransform WorldToPivot = FTransform(FQuat::Identity, -Pivot);//-BasePoint);
316
317 FVector frontLocOrig;
318 FVector frontLoc;
319
320 // Ending lerp out of a multi grip
322 {
323 WorldTransform.Blend(WorldTransform, RelativeTransOnSecondaryRelease* GrippingController->GetPivotTransform(), FMath::Clamp(Grip.SecondaryGripInfo.curLerp / Grip.SecondaryGripInfo.LerpToRate, 0.0f, 1.0f));
324 return true;
325 }
326 else // Is in a multi grip, might be lerping into it as well.
327 {
328 //FVector curLocation; // Current location of the secondary grip
329
330 // Calculates the correct secondary attachment location and sets frontLoc to it
331 CalculateSecondaryLocation(frontLoc, BasePoint, Grip, GrippingController);
332
333 frontLocOrig = (/*WorldTransform*/SecondaryTransform.TransformPosition(Grip.SecondaryGripInfo.SecondaryRelativeTransform.GetLocation())) - BasePoint;
334
335 // Apply any smoothing settings and lerping in / constant lerping
336 GunTools_ApplySmoothingAndLerp(Grip, frontLoc, frontLocOrig, DeltaTime, bSkipHighQualityOperations);
337
339 }
340
341 // Get any scaling addition from a scaling secondary grip type
342 FVector Scaler = FVector(1.0f);
343 GetAnyScaling(Scaler, Grip, frontLoc, frontLocOrig, SecondaryType, SecondaryTransform);
344
345 Grip.SecondaryGripInfo.SecondaryGripDistance = FVector::Dist(frontLocOrig, frontLoc);
346
348 {
349 float rotScaler = 1.0f - FMath::Clamp((Grip.SecondaryGripInfo.SecondaryGripDistance - AdvSecondarySettings.GripInfluenceDeadZone) / FMath::Max(AdvSecondarySettings.GripInfluenceDistanceToZero, 1.0f), 0.0f, 1.0f);
350 frontLoc = FMath::Lerp(frontLocOrig, frontLoc, rotScaler);
351 }
352
353 // Skip rot val for scaling only
354 if (SecondaryType != ESecondaryGripType::SG_ScalingOnly)
355 {
356 // Get shoulder mount addition rotation
357 if (!bSkipHighQualityOperations && bUseVirtualStock && bIsMounted)
358 {
359 // Get the rotation difference from the initial second grip
360 FQuat rotVal = FQuat::FindBetweenVectors(GrippingController->GetPivotLocation() - MountWorldTransform.GetTranslation(), (frontLoc + BasePoint) - MountWorldTransform.GetTranslation());
361 FQuat MountAdditionRotation = FQuat::FindBetweenVectors(frontLocOrig, GrippingController->GetPivotLocation() - MountWorldTransform.GetTranslation());
362
364 {
365 // Rebase the world transform to the pivot point, add the rotation, remove the pivot point rebase
366 FTransform NA = FTransform(rotVal * MountAdditionRotation, FVector::ZeroVector, Scaler);
367 FTransform NB = FTransform(FQuat::FindBetweenVectors(frontLocOrig, frontLoc), FVector::ZeroVector, Scaler);
368 NA.NormalizeRotation();
369 NB.NormalizeRotation();
370
371 // Quaternion interpolation
372 NA.Blend(NB, NA, VirtualStockSettings.StockLerpValue);
373
374 NewWorldTransform = WorldTransform * WorldToPivot * NA * PivotToWorld;
375 }
376 else
377 {
378 // Rebase the world transform to the pivot point, add the rotation, remove the pivot point rebase
379 NewWorldTransform = WorldTransform * WorldToPivot * MountAdditionRotation * FTransform(rotVal, FVector::ZeroVector, Scaler) * PivotToWorld;
380 }
381 }
382 else
383 {
384 // Get the rotation difference from the initial second grip
385 FQuat rotVal = FQuat::FindBetweenVectors(frontLocOrig, frontLoc);
386
387 // Rebase the world transform to the pivot point, add the rotation, remove the pivot point rebase
388 NewWorldTransform = WorldTransform * WorldToPivot * FTransform(rotVal, FVector::ZeroVector, Scaler) * PivotToWorld;
389 }
390 }
391 else
392 {
393
394 // Get shoulder mount addition rotation
395 if (!bSkipHighQualityOperations && bUseVirtualStock && bIsMounted)
396 {
397 FQuat MountAdditionRotation = FQuat::FindBetweenVectors(frontLocOrig, GrippingController->GetPivotLocation() - MountWorldTransform.GetTranslation());
398
399 // If it is exactly 1.0f then lets skip all of the extra logic and just set it
401 {
402 FTransform NA = FTransform(MountAdditionRotation, FVector::ZeroVector, Scaler);
403 FTransform NB = FTransform(FQuat::Identity, FVector::ZeroVector, Scaler);
404 NA.NormalizeRotation();
405 NB.NormalizeRotation();
406
407 // Quaternion interpolation
408 NA.Blend(NB, NA, VirtualStockSettings.StockLerpValue);
409 NewWorldTransform = WorldTransform * WorldToPivot * NA * PivotToWorld;
410 }
411 else
412 {
413 // Rebase the world transform to the pivot point, add the scaler, remove the pivot point rebase
414 NewWorldTransform = WorldTransform * WorldToPivot * MountAdditionRotation * FTransform(FQuat::Identity, FVector::ZeroVector, Scaler) * PivotToWorld;
415 }
416 }
417 else
418 {
419 // Rebase the world transform to the pivot point, add the scaler, remove the pivot point rebase
420 NewWorldTransform = WorldTransform * WorldToPivot * FTransform(FQuat::Identity, FVector::ZeroVector, Scaler) * PivotToWorld;
421 }
422 }
423 }
424
426 {
427 WorldTransform.Blend(NewWorldTransform, WorldTransform, FMath::Clamp(Grip.SecondaryGripInfo.curLerp / Grip.SecondaryGripInfo.LerpToRate, 0.0f, 1.0f));
428 }
429 else
430 {
431 WorldTransform = NewWorldTransform;
432 }
433
435 {
436 if (GrippingController->GetAttachParent())
437 {
438 FTransform ParentTrans = GrippingController->GetAttachParent()->GetComponentTransform();
439 FTransform ParentRel = WorldTransform * ParentTrans.Inverse();
441 WorldTransform = ParentRel * ParentTrans;
442 }
443 }
444
446 {
447 RelativeTransOnSecondaryRelease = WorldTransform.GetRelativeTransform(GrippingController->GetPivotTransform());
448 }
449 }
450
451 return true;
452}
453
455{
456
458 {
459 if (GrippingController->IsLocallyControlled())
460 {
461 FBPVirtualStockSettings VirtualSettings;
463 VirtualStockSettings.CopyFrom(VirtualSettings);
464 }
465 }
466
467 // Super doesn't do anything on grip
468
469 // Reset smoothing filters
471 {
473 {
474 const UVRGlobalSettings& VRSettings = *GetDefault<UVRGlobalSettings>();
478 }
479
481 }
482
484 {
486 }
487
488 GetVirtualStockTarget(GrippingController);
489}
490
492{
493 if (GrippingController && (GrippingController->bHasAuthority || bUseHighQualityRemoteSimulation))
494 {
495 if (AVRBaseCharacter * vrOwner = Cast<AVRBaseCharacter>(GrippingController->GetOwner()))
496 {
497 CameraComponent = vrOwner->VRReplicatedCamera;
498 return;
499 }
500 else
501 {
502 TArray<USceneComponent*> children = GrippingController->GetOwner()->GetRootComponent()->GetAttachChildren();
503
504 for (int i = 0; i < children.Num(); i++)
505 {
506 if (children[i]->IsA(UCameraComponent::StaticClass()))
507 {
508 CameraComponent = children[i];
509 return;
510 }
511 }
512 }
513
514 CameraComponent = nullptr;
515 }
516}
517
519{
520 // Super doesn't do anything on Secondary grip
521
522 // Reset smoothing filters
524 {
526 {
527 const UVRGlobalSettings& VRSettings = *GetDefault<UVRGlobalSettings>();
531 }
532
534 }
535
538}
539
541{
542 BackEndRecoilStorage = FTransform::Identity;
543 BackEndRecoilTarget = FTransform::Identity;
544}
545
546void UGS_GunTools::AddRecoilInstance(const FTransform & RecoilAddition, FVector Optional_Location)
547{
548 if (!bHasRecoil)
549 return;
550
552 {
553 if (FBodyInstance * BodyInst = GetParentBodyInstance())
554 {
555 BodyInst->AddImpulseAtPosition(RecoilAddition.GetLocation(), Optional_Location);
556 }
557 }
558 else
559 {
560 BackEndRecoilTarget += RecoilAddition;
561
562 FVector CurVec = BackEndRecoilTarget.GetTranslation();
563 CurVec.X = FMath::Clamp(CurVec.X, -FMath::Abs(MaxRecoilTranslation.X), FMath::Abs(MaxRecoilTranslation.X));
564 CurVec.Y = FMath::Clamp(CurVec.Y, -FMath::Abs(MaxRecoilTranslation.Y), FMath::Abs(MaxRecoilTranslation.Y));
565 CurVec.Z = FMath::Clamp(CurVec.Z, -FMath::Abs(MaxRecoilTranslation.Z), FMath::Abs(MaxRecoilTranslation.Z));
566 BackEndRecoilTarget.SetTranslation(CurVec);
567
568 FVector CurScale = BackEndRecoilTarget.GetScale3D();
569 CurScale.X = FMath::Clamp(CurScale.X, -FMath::Abs(MaxRecoilScale.X), FMath::Abs(MaxRecoilScale.X));
570 CurScale.Y = FMath::Clamp(CurScale.Y, -FMath::Abs(MaxRecoilScale.Y), FMath::Abs(MaxRecoilScale.Y));
571 CurScale.Z = FMath::Clamp(CurScale.Z, -FMath::Abs(MaxRecoilScale.Z), FMath::Abs(MaxRecoilScale.Z));
572 BackEndRecoilTarget.SetScale3D(CurScale);
573
574 FRotator curRot = BackEndRecoilTarget.Rotator();
575 curRot.Pitch = FMath::Clamp(curRot.Pitch, -FMath::Abs(MaxRecoilRotation.Y), FMath::Abs(MaxRecoilRotation.Y));
576 curRot.Yaw = FMath::Clamp(curRot.Yaw, -FMath::Abs(MaxRecoilRotation.Z), FMath::Abs(MaxRecoilRotation.Z));
577 curRot.Roll = FMath::Clamp(curRot.Roll, -FMath::Abs(MaxRecoilRotation.X), FMath::Abs(MaxRecoilRotation.X));
578 BackEndRecoilTarget.SetRotation(curRot.Quaternion());
579
580 bHasActiveRecoil = !BackEndRecoilTarget.Equals(FTransform::Identity);
581 }
582}
ESecondaryGripType
UENUM(Blueprintable)
virtual void GetAnyScaling(FVector &Scaler, FBPActorGripInformation &Grip, FVector &frontLoc, FVector &frontLocOrig, ESecondaryGripType SecondaryType, FTransform &SecondaryTransform)
virtual void CalculateSecondaryLocation(FVector &frontLoc, const FVector &BasePoint, FBPActorGripInformation &Grip, UGripMotionControllerComponent *GrippingController)
bool bUseGlobalVirtualStockSettings
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock")
bool bHasActiveRecoil
FVRVirtualStockModeChangedSignature OnVirtualStockModeChanged
UPROPERTY(BlueprintAssignable, Category = "VirtualStock")
FVector_NetQuantize100 PivotOffset
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pivot")
virtual void HandlePrePhysicsHandle(UGripMotionControllerComponent *GrippingController, const FBPActorGripInformation &GripInfo, FBPActorPhysicsHandleInformation *HandleInfo, FTransform &KinPose) override
bool bApplyRecoilAsPhysicalForce
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil")
float LerpRate
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil", meta = (editcondition = "bHasRecoil"...
TWeakObjectPtr< USceneComponent > VirtualStockComponent
UPROPERTY(BlueprintReadWrite, Category = "VirtualStock")
FTransform RelativeTransOnSecondaryRelease
FTransform OrientationComponentRelativeFacing
FVector GunTools_ApplySmoothingAndLerp(FBPActorGripInformation &Grip, FVector &frontLoc, FVector &frontLocOrig, float DeltaTime, bool bSkipHighQualitySimulations)
float DecayRate
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil", meta = (editcondition = "bHasRecoil"...
FBPVirtualStockSettings VirtualStockSettings
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock", meta = (editcondition = "!...
virtual bool GetWorldTransform_Implementation(UGripMotionControllerComponent *GrippingController, float DeltaTime, FTransform &WorldTransform, const FTransform &ParentTransform, FBPActorGripInformation &Grip, AActor *actor, UPrimitiveComponent *root, bool bRootHasInterface, bool bActorHasInterface, bool bIsForTeleport) override
virtual void OnGrip_Implementation(UGripMotionControllerComponent *GrippingController, const FBPActorGripInformation &GripInformation) override
FTransform BackEndRecoilStorage
FVector_NetQuantize100 MaxRecoilTranslation
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil", meta = (editcondition = "bHasRecoil"...
FName WeaponRootOrientationComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Settings")
bool bHasRecoil
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil")
void ResetRecoil()
UFUNCTION(BlueprintCallable, Category = "Recoil")
bool bUseVirtualStock
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock")
bool bUseHighQualityRemoteSimulation
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "GunSettings")
FTransform BackEndRecoilTarget
void GetVirtualStockTarget(UGripMotionControllerComponent *GrippingController)
FQuat StoredRootOffset
FGunTools_AdvSecondarySettings AdvSecondarySettings
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GunSettings")
FTransform MountWorldTransform
virtual void OnSecondaryGrip_Implementation(UGripMotionControllerComponent *Controller, USceneComponent *SecondaryGripComponent, const FBPActorGripInformation &GripInformation) override
void AddRecoilInstance(const FTransform &RecoilAddition, FVector Optional_Location=FVector::ZeroVector)
UFUNCTION(BlueprintCallable, Category = "Recoil")
UGS_GunTools(const FObjectInitializer &ObjectInitializer)
FVector_NetQuantize100 MaxRecoilRotation
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil", meta = (editcondition = "bHasRecoil"...
void ResetStockVariables()
virtual void OnBeginPlay_Implementation(UObject *CallingOwner) override
TWeakObjectPtr< USceneComponent > CameraComponent
FVector_NetQuantize100 MaxRecoilScale
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil", meta = (editcondition = "bHasRecoil"...
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = MotionController)
FBPActorPhysicsHandleInformation * GetPhysicsGrip(const FBPActorGripInformation &GripInfo)
static FRotator GetHMDPureYaw_I(FRotator HMDRotation)
UCLASS(config = Engine, defaultconfig)
float OneEuroMinCutoff
UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
float OneEuroDeltaCutoff
UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
static void GetVirtualStockGlobalSettings(FBPVirtualStockSettings &OutVirtualStockSettings)
UFUNCTION(BlueprintCallable, Category = "GunSettings|VirtualStock")
float OneEuroCutoffSlope
UPROPERTY(config, EditAnywhere, Category = "GunSettings|Secondary Grip 1Euro Settings")
FBodyInstance * GetParentBodyInstance(FName OptionalBoneName=NAME_None)
virtual UWorld * GetWorld() const override
bool bInjectPrePhysicsHandle
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "GSSettings")
EGSTransformOverrideType WorldTransformOverrideType
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "GSSettings")
bool bIsActive
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "GSSettings")
AActor * GetOwner()
UFUNCTION(BlueprintPure, Category = "VRGripScript")
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
bool bIsSlotGrip
UPROPERTY(BlueprintReadWrite, Category = "Settings")
FTransform AdditionTransform
UPROPERTY(BlueprintReadWrite, NotReplicated, Category = "Settings")
FTransform_NetQuantize RelativeTransform
UPROPERTY(BlueprintReadWrite, Category = "Settings")
FBPSecondaryGripInfo SecondaryGripInfo
UPROPERTY(BlueprintReadOnly, Category = "Settings")
USTRUCT(BlueprintType, Category = "VRExpansionLibrary")
float DeltaCutoff
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "FilterSettings")
float MinCutoff
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "FilterSettings")
float CutoffSlope
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "FilterSettings")
FTransform RunFilterSmoothing(const FTransform &InRawValue, const float &InDeltaTime)
USceneComponent * SecondaryAttachment
UPROPERTY(BlueprintReadOnly, Category = "SecondaryGripInfo")
EGripLerpState GripLerpState
float LerpToRate
UPROPERTY()
float SecondaryGripDistance
UPROPERTY(BlueprintReadOnly, NotReplicated, Category = "SecondaryGripInfo")
bool bHasSecondaryAttachment
UPROPERTY(BlueprintReadOnly, Category = "SecondaryGripInfo")
FTransform_NetQuantize SecondaryRelativeTransform
UPROPERTY(BlueprintReadOnly, Category = "SecondaryGripInfo")
USTRUCT(BlueprintType, Category = "GunSettings")
Definition GS_GunTools.h:22
bool bSmoothStockHand
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock|Smoothing")
Definition GS_GunTools.h:81
void CopyFrom(FBPVirtualStockSettings &B)
FVector_NetQuantize100 StockSnapOffset
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock")
Definition GS_GunTools.h:65
float StockSnapLerpThreshold
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock", meta = (ClampMin = "0....
Definition GS_GunTools.h:50
float StockSnapDistance
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock")
Definition GS_GunTools.h:40
float StockLerpValue
UPROPERTY(BlueprintReadOnly, Category = "VirtualStock")
Definition GS_GunTools.h:57
bool bAdjustZOfStockToPrimaryHand
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock")
Definition GS_GunTools.h:73
FBPEuroLowPassFilterTrans StockHandSmoothing
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GunSettings|VirtualStock|Smoothing")
Definition GS_GunTools.h:98
float SmoothingValueForStock
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VirtualStock|Smoothing", meta = (editconditio...
Definition GS_GunTools.h:90
bool bDebugDrawVirtualStock
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GunSettings|VirtualStock|Debug")
bool bUseAdvancedSecondarySettings
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AdvSecondarySettings")
FBPEuroLowPassFilter SecondarySmoothing
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AdvSecondarySettings|Smoothing")
float GripInfluenceDeadZone
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AdvSecondarySettings|DistanceInfluence",...
bool bUseConstantGripScaler
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AdvSecondarySettings|Smoothing",...
float GripInfluenceDistanceToZero
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AdvSecondarySettings|DistanceInfluence",...
bool bUseGlobalSmoothingSettings
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AdvSecondarySettings|Smoothing",...
bool bUseSecondaryGripDistanceInfluence
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AdvSecondarySettings|DistanceInfluence",...