Documentation for the Unreal C++ Plugin
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"
6#include "GripMotionControllerComponent.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 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
102 UChildActorComponent* WristMenu;
103
104 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
105 bool IsWristMenuEnabled = false;
106
110 UFUNCTION()
111 void GrabObject();
115 UFUNCTION()
116 void ReleaseObject();
122 UFUNCTION()
123 void ManuallyPutActorToHand(AActor* ActorRef);
129 UFUNCTION()
130 void OnObjectOutOfRange(const FBPActorGripInformation& GripInformation, float Distance);
136 UFUNCTION(BlueprintCallable, Category = "TouchWidget")
137 void OnTouchWidget(UWidgetComponent* WidgetComponent, UWidgetComponent* PreviousWidgetComponent);
141 UFUNCTION(BlueprintCallable, Category = "TouchWidget")
142 void DeactivateTouchCooldown();
147 UFUNCTION()
148 void ReleaseHeldObjectOnOtherHand(AActor* HeldActor);
149 UPROPERTY(BlueprintReadOnly, Replicated, Category = "PixoVR")
150 UObject* HandHoldingObject;
151
156 UFUNCTION(BlueprintCallable)
157 void ToggleLaser(bool Visible);
158 UPROPERTY()
159 USoundCue* LaserSound;
161 //Advance grab animation
168 UFUNCTION(BlueprintCallable, Category = "Animation")
169 TArray<FVector> GetRelativePointsArray(USplineComponent* FingerSpline, float Precision);
176 UFUNCTION(BlueprintCallable, Category = "Animation")
177 float TraceFingerForObstacle(TArray<FVector> RelativePointsArray);
182 UFUNCTION(BlueprintCallable, Category = "Animation")
183 void SetupFingerTracePoints();
184 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Animation")
185 FFingerData FingerData;
190 UFUNCTION(BlueprintCallable, Category = "Animation")
191 void UpdateFingerData();
192
193 UPROPERTY(BlueprintReadWrite, Category = "Animation")
194 bool UseCustomAnimation = false;
195
196 UPROPERTY(EditDefaultsOnly, Category = "Animation")
197 bool ChangeHandAnimationNearInteractableObject = false;
201 UPROPERTY(EditDefaultsOnly, Category = "Animation", meta = (EditCondition = "ChangeHandAnimationNearInteractableObject == true", EditConditionHides))
206 UPROPERTY(EditDefaultsOnly, Category = "Animation", meta = (EditCondition = "ChangeHandAnimationNearInteractableObject == true", EditConditionHides))
207 bool IsObjectHighlightActive = false;
208 bool InteractableObjectNearHand = false;
209 AActor* OverlapedActor = nullptr;
210
211 TArray<FVector> ThumbPositionCache;
212 TArray<FVector> IndexPositionCache;
213 TArray<FVector> MiddlePositionCache;
214 TArray<FVector> RingPositionCache;
215 TArray<FVector> PinkyPositionCache;
216
221 void GetOverlappingActor(FOverlappingInfo& OverlappingInfo);
222protected:
223 // Called when the game starts or when spawned
224 virtual void BeginPlay() override;
225
226 bool TouchComponentCooldownActive;
227
228public:
229 // Called every frame
230 virtual void Tick(float DeltaTime) override;
231
232 // Initialization
233 void InitPixoVRHands(EControllerHand MotionSource, APixoVRCharacter* Character);
234
239 UFUNCTION(BlueprintCallable, Category = "WristMenu")
240 void SetWristMenuEnabled(bool Enabled);
241
242 UPROPERTY(BlueprintReadWrite, Category = "Init", meta = (ExposeOnSpawn = "true"))
243 EControllerHand HandMotionSource;
244
245 UPROPERTY(BlueprintReadWrite, Category = "Init")
246 APixoVRCharacter* OwningCharacter;
247};
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:345
UWidgetInteractionComponent * TouchComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:172
bool TouchComponentCooldownActive
Definition PixoVRHand.h:360
FFingerData FingerData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Animation")
Definition PixoVRHand.h:304
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:389
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:347
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:349
EControllerHand HandMotionSource
UPROPERTY(BlueprintReadWrite, Category = "Init", meta = (ExposeOnSpawn = "true"))
Definition PixoVRHand.h:383
USplineComponent * IndexSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:148
TArray< FVector > IndexPositionCache
Definition PixoVRHand.h:346
UObject * HandHoldingObject
UPROPERTY(BlueprintReadOnly, Replicated, Category = "PixoVR")
Definition PixoVRHand.h:250
USoundCue * LaserSound
UPROPERTY()
Definition PixoVRHand.h:264
UChildActorComponent * WristMenu
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:178
TArray< FVector > RingPositionCache
Definition PixoVRHand.h:348
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