99 lines
2.3 KiB
C++
99 lines
2.3 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "DetectionManager.h"
|
|
#include "GestureData.h"
|
|
|
|
#include "HandActor.generated.h"
|
|
|
|
class AHandManager;
|
|
class AFingerTip;
|
|
class AGestureAction;
|
|
|
|
UCLASS()
|
|
class TABLE_API AHandActor : public AActor
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this actor's properties
|
|
AHandActor();
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stuff")
|
|
int32 HandId;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stuff")
|
|
EHandedness Handedness;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stuff")
|
|
float Confidence;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stuff")
|
|
TArray<FVector> Points; // size 21
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stuff")
|
|
TArray<AFingerTip*> FingerTipActorList; // size 21
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stuff")
|
|
AHandManager* HandManager;
|
|
|
|
FTimerHandle DeathTimer;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stuff")
|
|
int32 DeathTime = 5;
|
|
|
|
// Gestures
|
|
|
|
UPROPERTY(BlueprintReadWrite)
|
|
EHandGesturePhase Phase = EHandGesturePhase::None;
|
|
|
|
UPROPERTY(BlueprintReadWrite)
|
|
FName ActiveGestureName;
|
|
|
|
UPROPERTY(BlueprintReadWrite)
|
|
AGestureAction* ActiveAction;
|
|
|
|
UPROPERTY(BlueprintReadWrite)
|
|
TMap<FString, FVector> Anchors;
|
|
|
|
UPROPERTY(BlueprintReadWrite)
|
|
int32 CandidateFrames = 0;
|
|
|
|
UPROPERTY(BlueprintReadWrite)
|
|
int32 FailFrames = 0;
|
|
|
|
UPROPERTY(BlueprintReadOnly)
|
|
AHandActor* PairedHand = nullptr;
|
|
|
|
bool bUsedThisTick = false;
|
|
|
|
bool IsPaired() const { return PairedHand != nullptr; }
|
|
void ResetGesture();
|
|
|
|
protected:
|
|
// Called when the game starts or when spawned
|
|
virtual void BeginPlay() override;
|
|
|
|
public:
|
|
// Called every frame
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
FVector GetPalmCenter();
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
EHandedness GetHandedness();
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
|
void InitHand(const FHandPacketHand& NewHand, AHandManager* NewHandManager, TSubclassOf<class AFingerTip> FingerTipClass);
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
void UpdateHand(const FHandPacketHand& NewHand);
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
void HandDeath();
|
|
};
|