5#include "CoreMinimal.h"
6#include "..\Common\WeArtFingerState.h"
11#include "Components/ActorComponent.h"
28UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
35 UPROPERTY(BlueprintReadWrite)
39 UPROPERTY(BlueprintReadOnly)
40 AActor* GrabbedObject;
43 UPROPERTY(EditAnywhere, BlueprintReadWrite)
44 UWeArtTouchableObject* TouchedObject;
46 UPROPERTY(EditAnywhere, BlueprintReadWrite)
47 UWeArtTouchableObject* TouchedObjectByThumb;
49 UPROPERTY(EditAnywhere, BlueprintReadWrite)
50 UWeArtTouchableObject* TouchedObjectByIndex;
52 UPROPERTY(EditAnywhere, BlueprintReadWrite)
53 UWeArtTouchableObject* TouchedObjectByMiddle;
55 UPROPERTY(EditAnywhere, BlueprintReadWrite)
57 UPROPERTY(EditAnywhere, BlueprintReadWrite)
59 UPROPERTY(EditAnywhere, BlueprintReadWrite)
61 UPROPERTY(EditAnywhere, BlueprintReadWrite)
73 void UpdateClosureLimitsWhenGrabbed();
76 void OnReleasedGrabbedObject();
78 void HandleGraspingState(
void);
79 virtual
void TickComponent(
float DeltaTime, ELevelTick TickType,
80 FActorComponentTickFunction* ThisTickFunction) override;
82 bool CanControllerGrab();
89 UWeArtHapticObject* GetThumbHapticObject() const;
91 UWeArtHapticObject* GetIndexHapticObject() const;
93 UWeArtHapticObject* GetMiddleHapticObject() const;
97 UWeArtTouchableObject* IndexOverlapObj;
100 UWeArtTouchableObject* MiddleOverlapObj;
103 UWeArtTouchableObject* ThumbOverlapObj;
114 virtual
void BeginPlay() override;
125 UFUNCTION(BlueprintCallable)
126 void Init(UWeArtThimbleTrackingObject* ThumbTracking, UWeArtThimbleTrackingObject* IndexTracking,
127 UWeArtThimbleTrackingObject* MiddleTracking,
128 UWeArtHapticObject* ThumbHaptic, UWeArtHapticObject* IndexHaptic, UWeArtHapticObject* MiddleHaptic);
131 bool CheckHandClosingState();
133 UWeArtTouchableObject* GetTouchedObjectFromFingers();
135 void HandleFingerPoints();
143 void HandleMasterPoints();
145 float GetMaxValue(TArray<
float> numbers);
147 void HandleSlavePoints();
149 bool CheckGrabableStatus();
155 USkeletalMeshComponent* PhysicalHand;
157 USkeletalMeshComponent* VirtualHand;
166 UWeArtTouchableObject* GetTouchedObjectByFinger(FVector Location);
169 const FName PhysicalHandTag = "HandMesh";
170 const FName PhantomHandTag = "PhantomHand";
171 const FName VirtualHandTag = "VirtualHand";
173 const
float FingerTraceRadius = 1.4f;
175 const
float ContactDirectionThreshold = 0.3f;
177 const FVector PalmBoxTraceExtent = FVector(2.3, 5, 5);
179 const
float CheckBoundsPointRadius = 0.15f;
181 const
float ClosureThreshold = 0.4f;
183 const
float FingerCloseThreshold = 0.06f;
189 bool bInitialized = false;
191 int MasterContactPointsCount = 0;
193 int SlaveContactPointsCount = 0;
197 UWeArtHapticObject* ThumbHapticObject;
199 UWeArtHapticObject* IndexHapticObject;
201 UWeArtHapticObject* MiddleHapticObject;
202 bool bFoundGraspEvents;
204 UWeArtThimbleTrackingObject* ThumbTrackingObject;
206 UWeArtThimbleTrackingObject* IndexTrackingObject;
209 UFUNCTION(BlueprintCallable)
210 UWeArtThimbleTrackingObject* GetThumbTrackingObject() const;
212 UFUNCTION(BlueprintCallable)
213 UWeArtThimbleTrackingObject* GetIndexTrackingObject() const;
215 UFUNCTION(BlueprintCallable)
216 UWeArtThimbleTrackingObject* GetMiddleTrackingObject() const;
219 FHitResult TraceRay(const FVector StartLoc, const FVector Direction,
bool Debug) const;
221 AActor* TraceCapsule(FVector Location,
float Radius, FVector& HitLocation, FVector& HitNormal,
bool Debug = false);
223 AActor* TraceCapsuleOutActors(FVector Location,
float Radius, FVector& HitLocation, FVector& HitNormal, TArray<AActor*>& OutActors,
bool Debug = false);
225 AActor* TraceBox(FVector Location, FVector Extent, FRotator Orientation,
bool Debug = false);
229 UWeArtThimbleTrackingObject* MiddleTrackingObject;
#define WEARTPLUGIN_API
Definition: Definitions.WEARTPlugin.h:26
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnUXCalibrationStopSignature)
GraspingState
Definition: WeArtCommon.h:50
@ Released
Definition: WeArtCommon.h:52
HandClosingState
Definition: WeArtCommon.h:42
@ Open
Definition: WeArtCommon.h:43
EHandSide
Definition: WeArtCommon.h:8
WeArtFingerType
Definition: WeArtFingerType.h:4
ECollisionResponse GetResponseToHand(USkeletalMeshComponent *PhysicalHand, AActor *Source)
Definition: WeArtVirtualHand.cpp:6
Contains the declaration of the UWeArtVirtualHand class.
Definition: WeArtDebugActor.h:12
Handles events related to grasping actions.
Definition: WeArtGraspEvents.h:19
Definition: WeArtFingersDictionary.h:5
Animates hand movements for haptic feedback.
Definition: WeArtHandAnimInstance.h:14
Controls hand interactions and haptic feedback.
An animation instance class for virtual hand animations.
Definition: WeArtVirtualHand.h:20
Definition: WeArtFingerState.h:6