A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
PixoVRHand.h
Go to the documentation of this file.
1// Copyright(c) Pixo Group. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "GameFramework/Actor.h"
9#include "Components/SphereComponent.h"
10#include "Components/SplineComponent.h"
11#include "Components/WidgetComponent.h"
12#include "Components/WidgetInteractionComponent.h"
13#include "Sound/SoundCue.h"
14#include "PixoVRHand.generated.h"
15
17
22{
24 : OverlapActor(nullptr)
25 , OverlapComponent(nullptr)
26 , Socket(NAME_None)
27 {}
28
30 UPrimitiveComponent* OverlapComponent;
31 FName Socket;
32};
33
37USTRUCT(BlueprintType, Category = "Animation")
38struct FFingerData
39{
40 GENERATED_BODY()
42 UPROPERTY(EditAnywhere, BlueprintReadWrite)
43 float Thumb;
44 UPROPERTY(EditAnywhere, BlueprintReadWrite)
45 float Index;
46 UPROPERTY(EditAnywhere, BlueprintReadWrite)
47 float Middle;
48 UPROPERTY(EditAnywhere, BlueprintReadWrite)
49 float Ring;
50 UPROPERTY(EditAnywhere, BlueprintReadWrite)
51 float Pinky;
52};
53
57UENUM(BlueprintType, Category = "Animation")
58enum class EGrippableTypeChecker: uint8
59{
60 Default UMETA(DisplayName = "No Checker"),
61 StoryObject UMETA(DisplayName = "Object is using Story Object Interface"),
62 StoryActive UMETA(DisplayName = "Object is using Is Object Active"),
63 VRGrip UMETA(DisplayName = "Object is using VRGrip Interface"),
64};
65
69UCLASS()
70class PIXOCORE_API APixoVRHand : public AActor, public IPixoVRGripInterface
71{
72 GENERATED_BODY()
73
74public:
75 // Sets default values for this actor's properties
77
78 //Hands component
79 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
80 USceneComponent* Root;
81 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
82 UGripMotionControllerComponent* MotionController;
83 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
84 USphereComponent* GrabSphere;
85 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
86 USkeletalMeshComponent* HandMesh;
87 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
88 UStaticMeshComponent* LaserMesh;
89 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
90 USplineComponent* ThumbSpline;
91 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
92 USplineComponent* IndexSpline;
93 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
94 USplineComponent* MiddleSpline;
95 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
96 USplineComponent* RingSpline;
97 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
98 USplineComponent* PinkySpline;
99 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
100 UWidgetInteractionComponent* TouchComponent;
101
105 UFUNCTION()
106 void GrabObject();
110 UFUNCTION()
111 void ReleaseObject();
117 UFUNCTION()
118 void ManuallyPutActorToHand(AActor* ActorRef);
124 UFUNCTION(BlueprintCallable, Category = "TouchWidget")
125 void OnTouchWidget(UWidgetComponent* WidgetComponent, UWidgetComponent* PreviousWidgetComponent);
129 UFUNCTION(BlueprintCallable, Category = "TouchWidget")
130 void DeactivateTouchCooldown();
135 UFUNCTION()
136 void ReleaseHeldObjectOnOtherHand(AActor* HeldActor);
137 UPROPERTY(BlueprintReadOnly, Replicated, Category = "PixoVR")
138 UObject* HandHoldingObject;
139
144 UFUNCTION(BlueprintCallable)
145 void ToggleLaser(bool Visible);
146 UPROPERTY()
147 USoundCue* LaserSound;
149 //Advance grab animation
156 UFUNCTION(BlueprintCallable, Category = "Animation")
157 TArray<FVector> GetRelativePointsArray(USplineComponent* FingerSpline, float Precision);
164 UFUNCTION(BlueprintCallable, Category = "Animation")
165 float TraceFingerForObstacle(TArray<FVector> RelativePointsArray);
170 UFUNCTION(BlueprintCallable, Category = "Animation")
171 void SetupFingerTracePoints();
172 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Animation")
173 FFingerData FingerData;
178 UFUNCTION(BlueprintCallable, Category = "Animation")
179 void UpdateFingerData();
180
181 UPROPERTY(BlueprintReadWrite, Category = "Animation")
182 bool UseCustomAnimation = false;
183
184 UPROPERTY(EditDefaultsOnly, Category = "Animation")
185 bool ChangeHandAnimationNearInteractableObject = false;
189 UPROPERTY(EditDefaultsOnly, Category = "Animation", meta = (EditCondition = "ChangeHandAnimationNearInteractableObject == true", EditConditionHides))
194 UPROPERTY(EditDefaultsOnly, Category = "Animation", meta = (EditCondition = "ChangeHandAnimationNearInteractableObject == true", EditConditionHides))
195 bool IsObjectHighlightActive = false;
196 bool InteractableObjectNearHand = false;
197 AActor* OverlapedActor = nullptr;
198
199 TArray<FVector> ThumbPositionCache;
200 TArray<FVector> IndexPositionCache;
201 TArray<FVector> MiddlePositionCache;
202 TArray<FVector> RingPositionCache;
203 TArray<FVector> PinkyPositionCache;
204
205protected:
206 // Called when the game starts or when spawned
207 virtual void BeginPlay() override;
208
213 void GetOverlappingActor(FOverlappingInfo& OverlappingInfo);
214
215 bool TouchComponentCooldownActive;
216
217public:
218 // Called every frame
219 virtual void Tick(float DeltaTime) override;
220
221 // Initialization
222 void InitPixoVRHands(EControllerHand MotionSource, APixoVRCharacter* Character);
223
224 UPROPERTY(BlueprintReadWrite, Category = "Init", meta = (ExposeOnSpawn = "true"))
225 EControllerHand HandMotionSource;
226
227 UPROPERTY(BlueprintReadWrite, Category = "Init")
228 APixoVRCharacter* OwningCharacter;
229};
EGrippableTypeChecker
EGrippableTypeChecker is an enumeration that represents what type of objects we can grip.
Definition PixoVRHand.h:85
Pixo VR Character This class represents the main character in the Pixo VR game. It extends the AVRCha...
APixoVRHand is an actor class that represents a hand in the VR environment.
Definition PixoVRHand.h:99
TArray< FVector > ThumbPositionCache
Definition PixoVRHand.h:323
UWidgetInteractionComponent * TouchComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:172
bool TouchComponentCooldownActive
Definition PixoVRHand.h:339
FFingerData FingerData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Animation")
Definition PixoVRHand.h:282
UStaticMeshComponent * LaserMesh
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:136
USkeletalMeshComponent * HandMesh
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:130
APixoVRCharacter * OwningCharacter
UPROPERTY(BlueprintReadWrite, Category = "Init")
Definition PixoVRHand.h:358
USplineComponent * RingSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:160
USplineComponent * PinkySpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:166
TArray< FVector > MiddlePositionCache
Definition PixoVRHand.h:325
UGripMotionControllerComponent * MotionController
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:118
USphereComponent * GrabSphere
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:124
USplineComponent * MiddleSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:154
USceneComponent * Root
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:112
USplineComponent * ThumbSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:142
TArray< FVector > PinkyPositionCache
Definition PixoVRHand.h:327
EControllerHand HandMotionSource
UPROPERTY(BlueprintReadWrite, Category = "Init", meta = (ExposeOnSpawn = "true"))
Definition PixoVRHand.h:352
USplineComponent * IndexSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:148
TArray< FVector > IndexPositionCache
Definition PixoVRHand.h:324
UObject * HandHoldingObject
UPROPERTY(BlueprintReadOnly, Replicated, Category = "PixoVR")
Definition PixoVRHand.h:228
USoundCue * LaserSound
UPROPERTY()
Definition PixoVRHand.h:242
TArray< FVector > RingPositionCache
Definition PixoVRHand.h:326
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = MotionController)
FFingerData is a structure that holds finger animation data.
Definition PixoVRHand.h:42
float Middle
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:62
float Pinky
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:74
float Index
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:56
float Ring
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:68
float Thumb
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:50
FOverlappingInfo is a structure that holds information about overlapping actors and components.
Definition PixoVRHand.h:22
AActor * OverlapActor
Definition PixoVRHand.h:29
UPrimitiveComponent * OverlapComponent
Definition PixoVRHand.h:30