166 void RegisterEndPhysicsTick(
bool bRegister);
170 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category =
"GripMotionController|Advanced")
171 bool bProjectNonSimulatingGrips;
175 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced")
181 UPROPERTY(VisibleAnywhere, Transient, BlueprintReadOnly, Category = "GripMotionController|Advanced")
186 void HandleGlobalLerpToHand(
FBPActorGripInformation& GripInformation, FTransform& WorldTransform,
float DeltaTime);
188 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
189 void CancelGlobalLerpToHand(uint8 GripID);
194 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
195 FVROnControllerGripSignature OnLerpToHandFinished;
198 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking")
202 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking", meta = (ClampMin = "0.1", UIMin = "0.1", EditCondition = "bScaleTracking"))
203 FVector TrackingScaler;
206 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking")
207 bool bLimitMinHeight;
210 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking", meta = (ClampMin = "0.0", UIMin = "0.0", EditCondition = "bLimitMinHeight"))
214 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking")
215 bool bLimitMaxHeight;
218 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking", meta = (ClampMin = "0.1", UIMin = "0.1", EditCondition = "bLimitMinHeight"))
222 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking")
226 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking")
230 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced|Tracking", meta = (ClampMin = "0.1", UIMin = "0.1", EditCondition = "bLeashToHMD"))
233 void ApplyTrackingParameters(FVector& OriginalPosition,
bool bIsInGameThread);
234 bool HasTrackingParameters();
237 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Advanced")
238 bool bConstrainToPivot;
242 void UpdateTracking(
float DeltaTime);
243 virtual
void OnAttachmentChanged() override;
245 FVector LastLocationForLateUpdate;
246 FTransform LastRelativePosition;
249 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Smoothing")
250 bool bSmoothHandTracking;
252 bool bWasSmoothingHand;
255 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Smoothing")
256 bool bSmoothWithEuroLowPassFunction;
259 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Smoothing")
260 float SmoothingSpeed;
263 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|Smoothing")
266 FTransform LastSmoothRelativeTransform;
269 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|ComponentVelocity")
273 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|ComponentVelocity")
274 bool bSampleVelocityInWorldSpace;
277 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|ComponentVelocity")
278 int32 VelocitySamples;
282 virtual FVector GetComponentVelocity() const override;
288 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController")
289 bool bOffsetByControllerProfile;
292 FTransform CurrentControllerProfileTransform;
295 UPROPERTY(BlueprintAssignable, Category = "GripMotionController")
296 FVRGripControllerOnProfileTransformChanged OnControllerProfileTransformChanged;
299 UPROPERTY(BlueprintAssignable, Category = "GripMotionController")
300 FVRGripControllerOnGripOutOfRange OnGripOutOfRange;
312 void TickComponent(
float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
313 virtual
void InitializeComponent() override;
314 virtual
void OnUnregister() override;
316 virtual
void Deactivate() override;
317 virtual
void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
318 virtual
void BeginDestroy() override;
319 virtual
void BeginPlay() override;
327 virtual
void CreateRenderState_Concurrent(FRegisterComponentContext* Context) override;
328 virtual
void SendRenderTransform_Concurrent() override;
334 FTransform GripRenderThreadRelativeTransform = FTransform::Identity;
335 FVector GripRenderThreadComponentScale = FVector::ZeroVector;
336 FTransform GripRenderThreadProfileTransform = FTransform::Identity;
337 FVector GripRenderThreadLastLocationForLateUpdate = FVector::ZeroVector;
340 bool bRenderSmoothHandTracking =
false;
341 bool bRenderSmoothWithEuroLowPassFunction =
false;
342 float RenderSmoothingSpeed = 0.0f;
344 FTransform RenderLastSmoothRelativeTransform = FTransform::Identity;
345 float RenderLastDeltaTime = 0.0f;
348 FDelegateHandle NewControllerProfileEvent_Handle;
350 void NewControllerProfileLoaded();
351 void GetCurrentProfileTransform(
bool bBindToNoticationDelegate);
356 UPROPERTY(BlueprintAssignable, Category = "GripMotionController")
357 FVRGripControllerOnTrackingEventSignature OnTrackingChanged;
360 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
361 FVROnControllerGripSignature OnGrippedObject;
364 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
365 FVROnControllerDropSignature OnDroppedObject;
369 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
370 FVROnControllerSocketSignature OnSocketingObject;
373 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
374 FVROnControllerTeleportedGripsSignature OnTeleportedGrips;
377 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
378 FVROnControllerGripSignature OnSecondaryGripAdded;
381 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
382 FVROnControllerGripSignature OnSecondaryGripRemoved;
388 TArray<uint8> SecondaryGripIDs;
391 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
392 FVROnControllerGripSignature OnGripTransformChanged;
395 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions", meta = (bIgnoreSelf = "true",
DisplayName = "HandType", CompactNodeTitle = "HandType"))
396 void GetHandType(EControllerHand& Hand);
399 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "GripMotionController|CustomPivot")
403 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "GripMotionController|CustomPivot")
404 FName CustomPivotComponentSocketName;
408 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "GripMotionController|CustomPivot")
409 bool bSkipPivotTransformAdjustment;
412 UFUNCTION(BlueprintCallable, Category = "GripMotionController|CustomPivot")
413 void SetCustomPivotComponent(
USceneComponent * NewCustomPivotComponent, FName PivotSocketName = NAME_None);
416 UFUNCTION(BlueprintPure, Category = "GripMotionController", meta = (
DisplayName = "GetPivotTransform"))
417 FTransform GetPivotTransform_BP();
420 UFUNCTION(BlueprintPure, Category = "GripMotionController", meta = (
DisplayName = "GetPivotLocation"))
421 FVector GetPivotLocation_BP();
423 FORCEINLINE FTransform GetPivotTransform()
425 return CustomPivotComponent.IsValid() ? CustomPivotComponent->GetSocketTransform(CustomPivotComponentSocketName) : this->GetComponentTransform();
428 FORCEINLINE FVector GetPivotLocation()
430 return CustomPivotComponent.IsValid() ? CustomPivotComponent->GetSocketLocation(CustomPivotComponentSocketName) : this->GetComponentLocation();
436 uint8 GripIDIncrementer;
440 inline uint8 GetNextGripID(
bool bIsLocalGrip)
446 if (GripIDIncrementer < 127)
451 return GripIDIncrementer;
458 if (GripIDIncrementer < 63)
463 return GripIDIncrementer + 128;
467 if (GripIDIncrementer < 63)
472 return GripIDIncrementer + 128 + 64;
478 UPROPERTY(BlueprintReadOnly, Replicated, Category =
"GripMotionController", ReplicatedUsing = OnRep_GrippedObjects)
479 TArray<FBPActorGripInformation> GrippedObjects;
482 UPROPERTY(BlueprintReadOnly, Replicated, Category =
"GripMotionController", ReplicatedUsing = OnRep_LocallyGrippedObjects)
483 TArray<FBPActorGripInformation> LocallyGrippedObjects;
486 UPROPERTY(BlueprintReadOnly, Replicated, Category =
"GripMotionController", ReplicatedUsing = OnRep_LocalTransaction)
487 TArray<FBPActorGripInformation> LocalTransactionBuffer;
492 UFUNCTION(Reliable, Client, Category =
"GripMotionController")
493 void Client_NotifyInvalidLocalGrip(
UObject * LocallyGrippedObject, uint8 GripID,
bool bWasAGripConflict = false);
496 UFUNCTION(Reliable, Server, WithValidation, Category = "GripMotionController")
500 UFUNCTION(Reliable, Server, WithValidation)
501 void Server_NotifySecondaryAttachmentChanged(
507 UFUNCTION(Reliable, Server, WithValidation)
508 void Server_NotifySecondaryAttachmentChanged_Retain(
514 UFUNCTION(Reliable, Server, WithValidation)
515 void Server_NotifyLocalGripRemoved(uint8 GripID, const
FTransform_NetQuantize &TransformAtDrop, FVector_NetQuantize100 AngularVelocity, FVector_NetQuantize100 LinearVelocity);
517 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController|ClientAuth")
520 UPROPERTY(BlueprintAssignable, Category = "Grip Events")
521 FVROnClientAuthGripConflict OnClientAuthGripConflict;
524 UFUNCTION(Reliable, Server, WithValidation, Category = "GripMotionController")
525 void Server_NotifyHandledTransaction(uint8 GripID);
528 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController")
529 bool bAlwaysSendTickGrip;
532 void CleanUpBadGrip(TArray<
FBPActorGripInformation> &GrippedObjectsArray,
int GripIndex,
bool bReplicatedArray);
533 void CleanUpBadPhysicsHandles();
537 bool UpdatePhysicsHandle(uint8 GripID,
bool bFullyRecreate = true);
542 if (OnGripTransformChanged.IsBound())
546 GetGripByID(CurrentGrip, GripInfo.GripID, Result);
549 OnGripTransformChanged.Broadcast(CurrentGrip);
558 if (GetPhysicsGripIndex(GripInfo, HandleIndex))
560 DestroyPhysicsHandle(GripInfo);
564 NotifyGrip(GripInfo,
true);
617 SecondaryGripIDs.Add(Grip.
GripID);
620 TArray<UVRGripScriptBase*> GripScripts;
621 if (IVRGripInterface::Execute_GetGripScripts(Grip.
GrippedObject, GripScripts))
633 OnSecondaryGripAdded.Broadcast(Grip);
637 else if(OldGripInfo !=
nullptr)
671 if (bSendReleaseEvent)
675 IVRGripInterface::Execute_OnSecondaryGripRelease(Grip.
GrippedObject,
this, OldGripInfo->SecondaryGripInfo.SecondaryAttachment, Grip);
677 TArray<UVRGripScriptBase*> GripScripts;
678 if (IVRGripInterface::Execute_GetGripScripts(Grip.
GrippedObject, GripScripts))
684 Script->OnSecondaryGripRelease(
this, OldGripInfo->SecondaryGripInfo.SecondaryAttachment, Grip);
690 SecondaryGripIDs.Remove(Grip.
GripID);
691 OnSecondaryGripRemoved.Broadcast(Grip);
698 SecondaryGripIDs.Add(Grip.
GripID);
701 TArray<UVRGripScriptBase*> GripScripts;
702 if (IVRGripInterface::Execute_GetGripScripts(Grip.
GrippedObject, GripScripts))
714 OnSecondaryGripAdded.Broadcast(Grip);
728 bool bTransformChanged = !OldGripInfo->RelativeTransform.Equals(Grip.
RelativeTransform);
731 if (!FMath::IsNearlyEqual(OldGripInfo->Stiffness, Grip.
Stiffness) ||
732 !FMath::IsNearlyEqual(OldGripInfo->Damping, Grip.
Damping) ||
737 UpdatePhysicsHandle(Grip);
739 if (bTransformChanged)
741 NotifyGripTransformChanged(Grip);
753 inline void CheckTransactionBuffer()
755 if (LocalTransactionBuffer.Num())
757 for (
int i = LocalTransactionBuffer.Num() - 1; i >= 0; --i)
759 if (LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped && LocalTransactionBuffer[i].GripID != LocalTransactionBuffer[i].ValueCache.CachedGripID)
764 LocalTransactionBuffer[i].ClearNonReppingItems();
767 if (!LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped && LocalTransactionBuffer[i].GrippedObject->IsValidLowLevelFast())
769 LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped =
true;
770 LocalTransactionBuffer[i].ValueCache.CachedGripID = LocalTransactionBuffer[i].GripID;
772 int32 Index = LocallyGrippedObjects.Add(LocalTransactionBuffer[i]);
774 if (Index != INDEX_NONE)
776 NotifyGrip(LocallyGrippedObjects[Index]);
779 Server_NotifyHandledTransaction(LocalTransactionBuffer[i].GripID);
788 CheckTransactionBuffer();
798 for (
int i = GrippedObjects.Num() - 1; i >= 0; --i)
800 HandleGripReplication(GrippedObjects[i], OriginalArrayState.FindByKey(GrippedObjects[i].GripID));
807 for (
int i = LocallyGrippedObjects.Num() - 1; i >= 0; --i)
809 HandleGripReplication(LocallyGrippedObjects[i], OriginalArrayState.FindByKey(LocallyGrippedObjects[i].GripID));
813 UPROPERTY(BlueprintReadWrite, Category =
"GripMotionController")
814 TArray<UPrimitiveComponent *> AdditionalLateUpdateComponents;
819 UPROPERTY(EditDefaultsOnly, ReplicatedUsing = OnRep_ReplicatedControllerTransform, Category = "GripMotionController|Networking")
824 FVector LastUpdatesRelativePosition;
825 FRotator LastUpdatesRelativeRotation;
827 bool bLerpingPosition;
831 virtual
void OnRep_ReplicatedControllerTransform();
834 void RunNetworkedSmoothing(
float DeltaTime);
837 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "GripMotionController|Networking", meta = (ClampMin = "0", UIMin = "0"))
838 float ControllerNetUpdateRate;
841 float ControllerNetUpdateCount;
844 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "GripMotionController|Networking")
845 bool bSmoothReplicatedMotion;
848 UPROPERTY(EditAnywhere, Category = "GripMotionController|Networking|Smoothing", meta = (editcondition = "bSmoothReplicatedMotion"))
849 bool bUseExponentialSmoothing = true;
852 UPROPERTY(EditAnywhere, Category = "GripMotionController|Networking|Smoothing", meta = (editcondition = "bUseExponentialSmoothing"))
853 float InterpolationSpeed = 50.0f;
856 UPROPERTY(EditAnywhere, Category = "GripMotionController|Networking|Smoothing", meta = (editcondition = "bUseExponentialSmoothing"))
857 float NetworkMaxSmoothUpdateDistance = 50.f;
860 UPROPERTY(EditAnywhere, Category = "GripMotionController|Networking|Smoothing", meta = (editcondition = "bUseExponentialSmoothing"))
861 float NetworkNoSmoothUpdateDistance = 100.f;
864 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "GripMotionController|Networking")
865 bool bReplicateWithoutTracking;
868 UFUNCTION(Unreliable, Server, WithValidation)
873 VRBaseCharTransformRPC_Pointer OverrideSendTransform;
876 inline
bool IsLocallyControlled()
const
879 const AActor* MyOwner = GetOwner();
880 return MyOwner->HasLocalNetOwner();
886 UFUNCTION(BlueprintPure, Category =
"GripMotionController", meta = (
DisplayName =
"IsLocallyControlled"))
887 bool BP_IsLocallyControlled();
890 inline
bool IsTornOff()
const
892 const AActor* MyOwner = GetOwner();
893 return MyOwner ? MyOwner->GetTearOff() :
false;
897 inline bool IsServer()
const
899 if (GEngine !=
nullptr && GWorld !=
nullptr)
901 return GEngine->GetNetMode(GWorld) < NM_Client;
910 UFUNCTION(BlueprintCallable, Category =
"GripMotionController")
911 bool DropAndSocketObject(const
FTransform_NetQuantize & RelativeTransformToParent,
UObject * ObjectToDrop =
nullptr, uint8 GripIDToDrop = 0,
USceneComponent * SocketingParent =
nullptr, FName OptionalSocketName = NAME_None,
bool bWeldBodies = true);
916 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
921 UFUNCTION(Reliable, Server, WithValidation, Category = "GripMotionController")
922 void Server_NotifyDropAndSocketGrip(uint8 GripID,
USceneComponent * SocketingParent, FName OptionalSocketName, const
FTransform_NetQuantize & RelativeTransformToParent,
bool bWeldBodies = true);
924 UFUNCTION(Reliable, NetMulticast)
928 void Socket_Implementation(
UObject * ObjectToSocket,
bool bWasSimulating,
USceneComponent * SocketingParent, FName OptionalSocketName, const
FTransform_NetQuantize & RelativeTransformToParent,
bool bWeldBodies = true);
932 TArray<
UObject*> ObjectsWaitingForSocketUpdate;
956 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
959 const FTransform &WorldOffset,
960 bool bWorldOffsetIsRelative = false,
961 FName OptionalSnapToSocketName = NAME_None,
962 FName OptionalBoneToGripName = NAME_None,
966 float GripStiffness = 1500.0f,
967 float GripDamping = 200.0f,
bool bIsSlotGrip = false);
972 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
974 UObject * ObjectToDrop =
nullptr,
975 uint8 GripIdToDrop = 0,
976 bool bSimulate = false,
977 FVector OptionalAngularVelocity = FVector::ZeroVector,
978 FVector OptionalLinearVelocity = FVector::ZeroVector);
981 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
982 bool GripObjectByInterface(
UObject * ObjectToGrip, const FTransform &WorldOffset,
bool bWorldOffsetIsRelative = false, FName OptionalBoneToGripName = NAME_None, FName OptionalSnapToSocketName = NAME_None,
bool bIsSlotGrip = false);
986 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
987 bool DropObjectByInterface(
UObject * ObjectToDrop =
nullptr, uint8 GripIDToDrop = 0, FVector OptionalAngularVelocity = FVector::ZeroVector, FVector OptionalLinearVelocity = FVector::ZeroVector);
1005 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1008 const FTransform &WorldOffset,
1009 bool bWorldOffsetIsRelative = false,
1010 FName OptionalSnapToSocketName = NAME_None,
1011 FName OptionalBoneToGripName = NAME_None,
1015 float GripStiffness = 1500.0f,
1016 float GripDamping = 200.0f,
1017 bool bIsSlotGrip = false);
1020 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1024 FVector OptionalAngularVelocity = FVector::ZeroVector,
1025 FVector OptionalLinearVelocity = FVector::ZeroVector
1029 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1031 UPrimitiveComponent* ComponentToGrip,
1032 const FTransform &WorldOffset,
bool bWorldOffsetIsRelative = false,
1033 FName OptionalsnapToSocketName = NAME_None,
1034 FName OptionalBoneToGripName = NAME_None,
1038 float GripStiffness = 1500.0f,
1039 float GripDamping = 200.0f,
1040 bool bIsSlotGrip = false);
1043 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1045 UPrimitiveComponent* ComponentToDrop,
1047 FVector OptionalAngularVelocity = FVector::ZeroVector,
1048 FVector OptionalLinearVelocity = FVector::ZeroVector
1052 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1055 bool bSimulate = false,
1056 FVector OptionalAngularVelocity = FVector::ZeroVector,
1057 FVector OptionalLinearVelocity = FVector::ZeroVector);
1059 bool DropGrip_Implementation(
1061 bool bSimulate = false,
1062 FVector OptionalAngularVelocity = FVector::ZeroVector,
1063 FVector OptionalLinearVelocity = FVector::ZeroVector,
1064 bool bSkipNotify = false);
1070 UFUNCTION(Reliable, NetMulticast)
1077 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1081 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1085 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1089 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1096 UFUNCTION(BlueprintPure, Category = "GripMotionController")
1097 void GetPhysicsVelocities(const
FBPActorGripInformation &Grip, FVector &AngularVelocity, FVector &LinearVelocity);
1100 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1101 bool GetPhysicsConstraintForce(const
FBPActorGripInformation& Grip, FVector& AngularForce, FVector& LinearForce);
1104 UFUNCTION(BlueprintPure, Category = "GripMotionController")
1109 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1113 bool bIsPaused = false,
1114 bool bNoConstraintWhenPaused = false
1118 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1119 void SetGripHybridLock(
1122 bool bIsLocked = false
1126 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1127 void SetPausedTransform(
1129 const FTransform & PausedTransform,
1130 bool bTeleport = false
1134 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1135 void SetGripCollisionType(
1143 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1144 void SetGripLateUpdateSetting(
1152 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1153 void SetGripRelativeTransform(
1156 const FTransform & NewRelativeTransform
1160 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1161 void SetGripAdditionTransform(
1164 const FTransform & NewAdditionTransform,
bool bMakeGripRelative = false
1169 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1170 void SetGripStiffnessAndDamping(
1173 float NewStiffness,
float NewDamping,
bool bAlsoSetAngularValues = false,
float OptionalAngularStiffness = 0.0f,
float OptionalAngularDamping = 0.0f
1177 UFUNCTION(BlueprintPure, Category = "GripMotionController", meta = (
DisplayName = "CreateGripRelativeAdditionTransform"))
1178 FTransform CreateGripRelativeAdditionTransform_BP(
1180 const FTransform & AdditionTransform,
1181 bool bGripRelative = false
1184 inline FTransform CreateGripRelativeAdditionTransform(
1186 const FTransform & AdditionTransform,
1187 bool bGripRelative = false
1195 inline
bool HasGripAuthority(const
UObject * ObjToCheck);
1199 UFUNCTION(BlueprintPure, Category = "GripMotionController", meta = (
DisplayName = "HasGripAuthority"))
1204 UFUNCTION(BlueprintPure, Category = "GripMotionController", meta = (
DisplayName = "HasGripAuthorityForObject"))
1205 bool BP_HasGripAuthorityForObject(const
UObject* ObjToCheck);
1212 UFUNCTION(BlueprintPure, Category = "GripMotionController", meta = (
DisplayName = "HasGripMovementAuthority"))
1216 void TickGrip(
float DeltaTime);
1219 void HandleGripArray(TArray<
FBPActorGripInformation> &GrippedObjectsArray, const FTransform & ParentTransform,
float DeltaTime,
bool bReplicatedArray = false);
1222 bool GetGripWorldTransform(TArray<
UVRGripScriptBase*>& GripScripts,
float DeltaTime,FTransform & WorldTransform, const FTransform &ParentTransform,
FBPActorGripInformation &Grip,
AActor * actor, UPrimitiveComponent * root,
bool bRootHasInterface,
bool bActorHasInterface,
bool bIsForTeleport,
bool &bForceADrop);
1225 inline FTransform CalcControllerComponentToWorld(FRotator Orientation, FVector Position)
1227 return this->CalcNewComponentToWorld(FTransform(Orientation, Position));
1231 UFUNCTION(BlueprintPure, Category =
"GripMotionController")
1232 FTransform ConvertToControllerRelativeTransform(const FTransform & InTransform);
1235 UFUNCTION(BlueprintPure, Category = "GripMotionController")
1236 static FTransform ConvertToGripRelativeTransform(const FTransform& GrippedActorTransform, const FTransform & InTransform);
1239 UFUNCTION(BlueprintPure, Category = "GripMotionController")
1240 bool GetIsObjectHeld(const
UObject * ObjectToCheck);
1243 UFUNCTION(BlueprintPure, Category = "GripMotionController")
1244 bool GetIsHeld(const
AActor * ActorToCheck);
1247 UFUNCTION(BlueprintPure, Category = "GripMotionController")
1248 bool GetIsComponentHeld(const UPrimitiveComponent * ComponentToCheck);
1251 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1255 UFUNCTION(BlueprintPure, Category = "GripMotionController")
1256 bool HasGrippedObjects();
1260 UFUNCTION(BlueprintCallable, meta = (Keywords = "Grip",
DisplayName = "GetFirstActiveGrip", ScriptName = "GetFirstActiveGrip"), Category = "GripMotionController")
1265 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1269 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1270 void GetGrippedActors(TArray<
AActor*> &GrippedActorArray);
1273 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1274 void GetGrippedObjects(TArray<
UObject*> &GrippedObjectsArray);
1277 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1278 void GetGrippedComponents(TArray<UPrimitiveComponent*> &GrippedComponentsArray);
1282 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1283 void PostTeleportMoveGrippedObjects();
1285 bool bIsPostTeleport;
1289 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1290 bool TeleportMoveGrippedActor(
AActor * GrippedActorToMove,
bool bTeleportPhysicsGrips = true);
1294 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1295 bool TeleportMoveGrippedComponent(UPrimitiveComponent * ComponentToMove,
bool bTeleportPhysicsGrips = true);
1300 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1301 bool TeleportMoveGrip(UPARAM(ref)
FBPActorGripInformation &Grip,
bool bTeleportPhysicsGrips = true,
bool bIsForPostTeleport = false);
1302 bool TeleportMoveGrip_Impl(
FBPActorGripInformation &Grip,
bool bTeleportPhysicsGrips,
bool bIsForPostTeleport, FTransform & OptionalTransform);
1305 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1306 void TeleportMoveGrips(
bool bTeleportPhysicsGrips = true,
bool bIsForPostTeleport = false);
1309 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1310 bool AddSecondaryAttachmentPoint(
UObject * GrippedObjectToAddAttachment,
USceneComponent * SecondaryPointComponent, const FTransform &OriginalTransform,
bool bTransformIsAlreadyRelative = false,
float LerpToTime = 0.25f,
bool bIsSlotGrip = false, FName SecondarySlotName = NAME_None);
1313 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1314 bool AddSecondaryAttachmentToGrip(const
FBPActorGripInformation & GripToAddAttachment,
USceneComponent * SecondaryPointComponent, const FTransform &OriginalTransform,
bool bTransformIsAlreadyRelative = false,
float LerpToTime = 0.25f,
bool bIsSlotGrip = false, FName SecondarySlotName = NAME_None);
1317 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1318 bool AddSecondaryAttachmentToGripByID(const uint8 GripID,
USceneComponent* SecondaryPointComponent, const FTransform& OriginalTransform,
bool bTransformIsAlreadyRelative = false,
float LerpToTime = 0.25f,
bool bIsSlotGrip = false, FName SecondarySlotName = NAME_None);
1321 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1322 bool RemoveSecondaryAttachmentPoint(
UObject * GrippedObjectToRemoveAttachment,
float LerpToTime = 0.25f);
1325 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1326 bool RemoveSecondaryAttachmentFromGrip(const
FBPActorGripInformation & GripToRemoveAttachment,
float LerpToTime = 0.25f);
1329 UFUNCTION(BlueprintCallable, Category = "GripMotionController")
1330 bool RemoveSecondaryAttachmentFromGripByID(const uint8 GripID = 0,
float LerpToTime = 0.25f);
1333 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController")
1334 bool bIgnoreTrackingStatus;
1337 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripMotionController")
1338 bool bUseWithoutTracking;
1340 bool CheckComponentWithSweep(UPrimitiveComponent * ComponentToCheck, FVector Move, FRotator newOrientation,
bool bSkipSimulatingComponents);
1343 void OnGripMassUpdated(FBodyInstance* GripBodyInstance);
1346 void UpdatePhysicsHandleTransform(const
FBPActorGripInformation &GrippedActor, const FTransform& NewTransform);
1347 bool SetGripConstraintStiffnessAndDamping(const
FBPActorGripInformation *Grip,
bool bUseHybridMultiplier = false);
1348 bool GetPhysicsJointLength(const
FBPActorGripInformation &GrippedActor, UPrimitiveComponent * rootComp, FVector & LocOut);
1360 UFUNCTION(BlueprintCallable, Category = "GripMotionController|
Custom", meta = (
DisplayName = "GetPhysicsHandleSettings"))
1364 UFUNCTION(BlueprintCallable, Category = "GripMotionController|
Custom", meta = (
DisplayName = "SetPhysicsHandleSettings"))
1368 UFUNCTION(BlueprintCallable, Category = "GripMotionController|
Custom", meta = (
DisplayName = "SetUpPhysicsHandle"))
1372 UFUNCTION(BlueprintCallable, Category = "GripMotionController|
Custom", meta = (
DisplayName = "DestroyPhysicsHandle"))
1377 UFUNCTION(BlueprintCallable, Category = "GripMotionController|
Custom", meta = (
DisplayName = "UpdatePhysicsHandle"))
1381 UFUNCTION(BlueprintCallable, Category = "GripMotionController|
Custom", meta = (
DisplayName = "UpdatePhysicsHandleTransform"))
1382 void UpdatePhysicsHandleTransform_BP(UPARAM(ref)const
FBPActorGripInformation &GrippedActor, UPARAM(ref)const FTransform& NewTransform);
1385 UFUNCTION(BlueprintCallable, Category = "GripMotionController|
Custom", meta = (
DisplayName = "GetGripDistance"))
1386 bool GetGripDistance_BP(UPARAM(ref)
FBPActorGripInformation &Grip, FVector ExpectedLocation,
float & CurrentDistance);
1389 virtual
bool GripPollControllerState(FVector& Position, FRotator& Orientation,
float WorldToMetersScale);
1399 UFUNCTION(BlueprintPure, Category = "GripMotionController")
1400 bool GripControllerIsTracked() const;
1406 UFUNCTION(BlueprintCallable, Category = "GripMotionController", meta = (ExpandEnumAsExecs = "Result"))
1407 void GetControllerDeviceID(FXRDeviceId & DeviceID,
EBPVRResultSwitch &Result,
bool bCheckOpenVROnly = false);
1427 virtual void SetupViewFamily(FSceneViewFamily& InViewFamily)
override {}
1428 virtual void SetupView(FSceneViewFamily& InViewFamily, FSceneView& InView)
override {}
1429 virtual void BeginRenderViewFamily(FSceneViewFamily& InViewFamily)
override;
1430 virtual void PreRenderView_RenderThread(FRHICommandListImmediate& RHICmdList, FSceneView& InView)
override {}
1431 virtual void PreRenderViewFamily_RenderThread(FRHICommandListImmediate& RHICmdList, FSceneViewFamily& InViewFamily)
override;
1432 virtual void LateLatchingViewFamily_RenderThread(FRHICommandListImmediate& RHICmdList, FSceneViewFamily& InViewFamily)
override;
1434 virtual int32 GetPriority()
const override {
return -10; }
1444 TSharedPtr< FGripViewExtension, ESPMode::ThreadSafe > GripViewExtension;
1450 const FTransform & AdditionTransform,
1455 FTransform FinalTransform;
1459 FinalTransform = FTransform(AdditionTransform.GetRotation(), GripToSample.
RelativeTransform.GetRotation().RotateVector(AdditionTransform.GetLocation()), AdditionTransform.GetScale3D());
1463 const FTransform PivotToWorld = FTransform(FQuat::Identity, GripToSample.
RelativeTransform.GetLocation());
1464 const FTransform WorldToPivot = FTransform(FQuat::Identity, -GripToSample.
RelativeTransform.GetLocation());
1467 FTransform RotationOffsetTransform(AdditionTransform.GetRotation(), FVector::ZeroVector);
1468 FinalTransform = FTransform(FQuat::Identity, AdditionTransform.GetLocation(), AdditionTransform.GetScale3D()) * WorldToPivot * RotationOffsetTransform * PivotToWorld;
1471 return FinalTransform;
1493 if (!ObjToCheck->GetClass()->ImplementsInterface(UVRGripInterface::StaticClass()) &&
IsServer())