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;
56 UPROPERTY(EditAnywhere, BlueprintReadWrite)
58 UPROPERTY(EditAnywhere, BlueprintReadWrite)
60 UPROPERTY(EditAnywhere, BlueprintReadWrite)
75 void UpdateClosureLimitsWhenGrabbed();
78 void OnReleasedGrabbedObject();
80 void HandleGraspingState(
void);
81 virtual
void TickComponent(
float DeltaTime, ELevelTick TickType,
82 FActorComponentTickFunction* ThisTickFunction) override;
88 UWeArtHapticObject* GetThumbHapticObject() const;
90 UWeArtHapticObject* GetIndexHapticObject() const;
92 UWeArtHapticObject* GetMiddleHapticObject() const;
95 UWeArtTouchableObject* IndexOverlapObj;
97 UWeArtTouchableObject* MiddleOverlapObj;
99 UWeArtTouchableObject* ThumbOverlapObj;
110 virtual
void BeginPlay() override;
121 UFUNCTION(BlueprintCallable)
122 void Init(UWeArtThimbleTrackingObject* ThumbTracking, UWeArtThimbleTrackingObject* IndexTracking,
123 UWeArtThimbleTrackingObject* MiddleTracking,
124 UWeArtHapticObject* ThumbHaptic, UWeArtHapticObject* IndexHaptic, UWeArtHapticObject* MiddleHaptic);
127 bool CheckHandClosingState();
129 UWeArtTouchableObject* GetTouchedObjectFromFingers();
131 void HandleFingerPoints();
139 void HandleMasterPoints();
141 float GetMaxValue(TArray<
float> numbers);
143 void HandleSlavePoints();
145 bool CheckGrabableStatus();
151 USkeletalMeshComponent* PhysicalHand;
153 USkeletalMeshComponent* VirtualHand;
162 UWeArtTouchableObject* GetTouchedObjectByFinger(FVector Location);
164 FHitResult TraceRay(const FVector StartLoc, const FVector Direction,
bool Debug);
166 AActor* TraceCapsule(FVector Location,
float Radius, FVector& HitLocation, FVector& HitNormal,
bool Debug = false);
168 AActor* TraceCapsuleOutActors(FVector Location,
float Radius, FVector& HitLocation, FVector& HitNormal, TArray<AActor*>& OutActors,
bool Debug = false);
170 AActor* TraceBox(FVector Location, FVector Extent, FRotator Orientation,
bool Debug = false);
174 const FName PhysicalHandTag = "HandMesh";
175 const FName PhantomHandTag = "PhantomHand";
176 const FName VirtualHandTag = "VirtualHand";
178 const
float FingerTraceRadius = 1.4f;
180 const
float ContactDirectionThreshold = 0.3f;
182 const FVector PalmBoxTraceExtent = FVector(2.3, 5, 5);
184 const
float CheckBoundsPointRadius = 0.15f;
186 const
float ClosureThreshold = 0.4f;
188 const
float FingerCloseThreshold = 0.06f;
194 bool bInitialized = false;
196 int MasterContactPointsCount = 0;
198 int SlaveContactPointsCount = 0;
201 UWeArtHapticObject* ThumbHapticObject;
202 UWeArtHapticObject* IndexHapticObject;
203 UWeArtHapticObject* MiddleHapticObject;
204 bool bFoundGraspEvents;
205 UWeArtThimbleTrackingObject* ThumbTrackingObject;
206 UWeArtThimbleTrackingObject* IndexTrackingObject;
210 UWeArtThimbleTrackingObject* GetThumbTrackingObject() const;
212 UWeArtThimbleTrackingObject* GetIndexTrackingObject() const;
214 UWeArtThimbleTrackingObject* GetMiddleTrackingObject() const;
217 UWeArtThimbleTrackingObject* MiddleTrackingObject;
#define WEARTPLUGIN_API
Definition: Definitions.WEARTPlugin.h:292
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