From a2c67c4aacb93f8a5a1df503c7d0b4178ad81e77 Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Thu, 4 May 2023 17:31:19 +0200 Subject: [PATCH] set up the overlap events for the grab/touch fingertip colliders --- .../SenseGlove/GameFramework/SGPawn.cpp | 507 ++++++++++++++++++ .../GameFramework/SGVirtualHandActor.cpp | 253 +++++++++ .../Public/SenseGlove/GameFramework/SGPawn.h | 258 +++++++++ .../GameFramework/SGVirtualHandActor.h | 130 +++++ 4 files changed, 1148 insertions(+) diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp index 55cff267..46bfd594 100644 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp +++ b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGPawn.cpp @@ -70,6 +70,12 @@ struct ASGPawn::FImpl /************************ * Methods ************************/ + + void BindFingerGrabOverlapEvents(); + void UnbindFingerGrabOverlapEvents(); + + void BindFingerTouchOverlapEvents(); + void UnbindFingerTouchOverlapEvents(); }; ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) @@ -450,6 +456,17 @@ void ASGPawn::BeginPlay() { HandRight->SetWorldRotation(Rotation); }); + + Pimpl->BindFingerGrabOverlapEvents(); + Pimpl->BindFingerTouchOverlapEvents(); +} + +void ASGPawn::EndPlay(const EEndPlayReason::Type EndPlayReason) +{ + Super::EndPlay(EndPlayReason); + + Pimpl->UnbindFingerGrabOverlapEvents(); + Pimpl->UnbindFingerTouchOverlapEvents(); } void ASGPawn::PreInitializeComponents() @@ -460,11 +477,501 @@ void ASGPawn::PreInitializeComponents() WristTrackerRight->SetRight(HandRight->IsRight()); } +void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnLeftRingFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnLeftRingFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnRightThumbFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnRightThumbFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnRightIndexFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnRightIndexFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnRightRingFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnRightRingFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + ASGPawn::FImpl::FImpl(ASGPawn* InOwner) : Owner(InOwner) { } +void ASGPawn::FImpl::BindFingerGrabOverlapEvents() +{ + Owner->LeftThumbFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftThumbFingertipGrabColliderOverlapBegins); + Owner->LeftThumbFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftThumbFingertipGrabColliderOverlapEnds); + + Owner->LeftIndexFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftIndexFingertipGrabColliderOverlapBegins); + Owner->LeftIndexFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftIndexFingertipGrabColliderOverlapEnds); + + Owner->LeftMiddleFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapBegins); + Owner->LeftMiddleFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapEnds); + + Owner->RightThumbFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins); + Owner->RightThumbFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds); + + Owner->RightIndexFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins); + Owner->RightIndexFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds); + + Owner->RightMiddleFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins); + Owner->RightMiddleFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds); +} + +void ASGPawn::FImpl::UnbindFingerGrabOverlapEvents() +{ + Owner->LeftThumbFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftThumbFingertipGrabColliderOverlapBegins); + Owner->LeftThumbFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftThumbFingertipGrabColliderOverlapEnds); + + Owner->LeftIndexFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftIndexFingertipGrabColliderOverlapBegins); + Owner->LeftIndexFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftIndexFingertipGrabColliderOverlapEnds); + + Owner->LeftMiddleFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapBegins); + Owner->LeftMiddleFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapEnds); + + Owner->RightThumbFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins); + Owner->RightThumbFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds); + + Owner->RightIndexFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins); + Owner->RightIndexFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds); + + Owner->RightMiddleFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins); + Owner->RightMiddleFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds); +} + +void ASGPawn::FImpl::BindFingerTouchOverlapEvents() +{ + Owner->LeftThumbFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftThumbFingertipTouchColliderOverlapBegins); + Owner->LeftThumbFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftThumbFingertipTouchColliderOverlapEnds); + + Owner->LeftIndexFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftIndexFingertipTouchColliderOverlapBegins); + Owner->LeftIndexFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftIndexFingertipTouchColliderOverlapEnds); + + Owner->LeftMiddleFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapBegins); + Owner->LeftMiddleFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapEnds); + + Owner->LeftRingFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftRingFingertipTouchColliderOverlapBegins); + Owner->LeftRingFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftRingFingertipTouchColliderOverlapEnds); + + Owner->LeftPinkyFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapBegins); + Owner->LeftPinkyFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapEnds); + + Owner->RightThumbFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins); + Owner->RightThumbFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds); + + Owner->RightIndexFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins); + Owner->RightIndexFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds); + + Owner->RightMiddleFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins); + Owner->RightMiddleFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds); + + Owner->RightThumbFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightThumbFingertipTouchColliderOverlapBegins); + Owner->RightThumbFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightThumbFingertipTouchColliderOverlapEnds); + + Owner->RightIndexFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightIndexFingertipTouchColliderOverlapBegins); + Owner->RightIndexFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightIndexFingertipTouchColliderOverlapEnds); + + Owner->RightMiddleFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipTouchColliderOverlapBegins); + Owner->RightMiddleFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipTouchColliderOverlapEnds); + + Owner->RightRingFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightRingFingertipTouchColliderOverlapBegins); + Owner->RightRingFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightRingFingertipTouchColliderOverlapEnds); + + Owner->RightPinkyFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGPawn::OnRightPinkyFingertipTouchColliderOverlapBegins); + Owner->RightPinkyFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGPawn::OnRightPinkyFingertipTouchColliderOverlapEnds); +} + +void ASGPawn::FImpl::UnbindFingerTouchOverlapEvents() +{ + Owner->LeftThumbFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftThumbFingertipTouchColliderOverlapBegins); + Owner->LeftThumbFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftThumbFingertipTouchColliderOverlapEnds); + + Owner->LeftIndexFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftIndexFingertipTouchColliderOverlapBegins); + Owner->LeftIndexFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftIndexFingertipTouchColliderOverlapEnds); + + Owner->LeftMiddleFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapBegins); + Owner->LeftMiddleFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapEnds); + + Owner->LeftRingFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftRingFingertipTouchColliderOverlapBegins); + Owner->LeftRingFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftRingFingertipTouchColliderOverlapEnds); + + Owner->LeftPinkyFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapBegins); + Owner->LeftPinkyFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapEnds); + + Owner->RightThumbFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins); + Owner->RightThumbFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds); + + Owner->RightIndexFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins); + Owner->RightIndexFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds); + + Owner->RightMiddleFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins); + Owner->RightMiddleFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds); + + Owner->RightThumbFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightThumbFingertipTouchColliderOverlapBegins); + Owner->RightThumbFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightThumbFingertipTouchColliderOverlapEnds); + + Owner->RightIndexFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightIndexFingertipTouchColliderOverlapBegins); + Owner->RightIndexFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightIndexFingertipTouchColliderOverlapEnds); + + Owner->RightMiddleFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipTouchColliderOverlapBegins); + Owner->RightMiddleFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightMiddleFingertipTouchColliderOverlapEnds); + + Owner->RightRingFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightRingFingertipTouchColliderOverlapBegins); + Owner->RightRingFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightRingFingertipTouchColliderOverlapEnds); + + Owner->RightPinkyFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightPinkyFingertipTouchColliderOverlapBegins); + Owner->RightPinkyFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGPawn::OnRightPinkyFingertipTouchColliderOverlapEnds); +} + ASGPawn::FImpl::~FImpl() = default; void ASGPawn::FImplDeleter::operator()(const FImpl* P) const diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp index ec4c4608..9644aa6f 100644 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp +++ b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp @@ -65,6 +65,12 @@ struct ASGVirtualHandActor::FImpl /************************ * Methods ************************/ + + void BindFingerGrabOverlapEvents(); + void UnbindFingerGrabOverlapEvents(); + + void BindFingerTouchOverlapEvents(); + void UnbindFingerTouchOverlapEvents(); }; ASGVirtualHandActor::ASGVirtualHandActor(const FObjectInitializer& ObjectInitializer) @@ -257,6 +263,17 @@ void ASGVirtualHandActor::BeginPlay() { VirtualHand->SetWorldRotation(Rotation); }); + + Pimpl->BindFingerGrabOverlapEvents(); + Pimpl->BindFingerTouchOverlapEvents(); +} + +void ASGVirtualHandActor::EndPlay(const EEndPlayReason::Type EndPlayReason) +{ + Super::EndPlay(EndPlayReason); + + Pimpl->UnbindFingerGrabOverlapEvents(); + Pimpl->UnbindFingerTouchOverlapEvents(); } void ASGVirtualHandActor::PreInitializeComponents() @@ -287,11 +304,247 @@ bool ASGVirtualHandActor::IsGloveConnected() const return VirtualHand->IsGloveConnected(); } +void ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + +void ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex, + const bool bFromSweep, + const FHitResult& SweepResult) +{ +} + +void ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + const int32 OtherBodyIndex) +{ +} + ASGVirtualHandActor::FImpl::FImpl(ASGVirtualHandActor* InOwner) : Owner(InOwner) { } +void ASGVirtualHandActor::FImpl::BindFingerGrabOverlapEvents() +{ + Owner->ThumbFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapBegins); + Owner->ThumbFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapEnds); + + Owner->IndexFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapBegins); + Owner->IndexFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapEnds); + + Owner->MiddleFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapBegins); + Owner->MiddleFingertipGrabCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapEnds); +} + +void ASGVirtualHandActor::FImpl::UnbindFingerGrabOverlapEvents() +{ + Owner->ThumbFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapBegins); + Owner->ThumbFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapEnds); + + Owner->IndexFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapBegins); + Owner->IndexFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapEnds); + + Owner->MiddleFingertipGrabCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapBegins); + Owner->MiddleFingertipGrabCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapEnds); +} + +void ASGVirtualHandActor::FImpl::BindFingerTouchOverlapEvents() +{ + Owner->ThumbFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapBegins); + Owner->ThumbFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapEnds); + + Owner->IndexFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapBegins); + Owner->IndexFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapEnds); + + Owner->MiddleFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapBegins); + Owner->MiddleFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapEnds); + + Owner->RingFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapBegins); + Owner->RingFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapEnds); + + Owner->PinkyFingertipTouchCollider->OnComponentBeginOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapBegins); + Owner->PinkyFingertipTouchCollider->OnComponentEndOverlap.AddDynamic( + Owner, &ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapEnds); +} + +void ASGVirtualHandActor::FImpl::UnbindFingerTouchOverlapEvents() +{ + Owner->ThumbFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapBegins); + Owner->ThumbFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapEnds); + + Owner->IndexFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapBegins); + Owner->IndexFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapEnds); + + Owner->MiddleFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapBegins); + Owner->MiddleFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapEnds); + + Owner->RingFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapBegins); + Owner->RingFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapEnds); + + Owner->PinkyFingertipTouchCollider->OnComponentBeginOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapBegins); + Owner->PinkyFingertipTouchCollider->OnComponentEndOverlap.RemoveDynamic( + Owner, &ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapEnds); +} + ASGVirtualHandActor::FImpl::~FImpl() = default; void ASGVirtualHandActor::FImplDeleter::operator()(const FImpl* P) const diff --git a/Source/SenseGlove/Public/SenseGlove/GameFramework/SGPawn.h b/Source/SenseGlove/Public/SenseGlove/GameFramework/SGPawn.h index 10f8422a..ff92e5cb 100644 --- a/Source/SenseGlove/Public/SenseGlove/GameFramework/SGPawn.h +++ b/Source/SenseGlove/Public/SenseGlove/GameFramework/SGPawn.h @@ -237,5 +237,263 @@ public: public: virtual void BeginPlay() override; + virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; virtual void PreInitializeComponents() override; + +protected: + UFUNCTION() + virtual void OnLeftThumbFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnLeftThumbFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnLeftIndexFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnLeftIndexFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnLeftMiddleFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnLeftMiddleFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnLeftThumbFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnLeftThumbFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnLeftIndexFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnLeftIndexFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnLeftMiddleFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnLeftMiddleFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnLeftRingFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnLeftRingFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnLeftPinkyFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnLeftPinkyFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRightThumbFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRightThumbFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRightIndexFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRightIndexFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRightMiddleFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRightMiddleFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRightThumbFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRightThumbFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRightIndexFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRightIndexFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRightMiddleFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRightMiddleFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRightRingFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRightRingFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRightPinkyFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRightPinkyFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); }; \ No newline at end of file diff --git a/Source/SenseGlove/Public/SenseGlove/GameFramework/SGVirtualHandActor.h b/Source/SenseGlove/Public/SenseGlove/GameFramework/SGVirtualHandActor.h index 1932a501..ec98e320 100644 --- a/Source/SenseGlove/Public/SenseGlove/GameFramework/SGVirtualHandActor.h +++ b/Source/SenseGlove/Public/SenseGlove/GameFramework/SGVirtualHandActor.h @@ -161,6 +161,7 @@ protected: public: virtual void BeginPlay() override; + virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; virtual void PreInitializeComponents() override; public: @@ -169,4 +170,133 @@ public: void SetRight(bool bRight); bool IsGloveConnected() const; + +protected: + UFUNCTION() + virtual void OnThumbFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnThumbFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnIndexFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnIndexFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnMiddleFingertipGrabColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnMiddleFingertipGrabColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnThumbFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnThumbFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnIndexFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnIndexFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnMiddleFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnMiddleFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnRingFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnRingFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); + + UFUNCTION() + virtual void OnPinkyFingertipTouchColliderOverlapBegins( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult); + + UFUNCTION() + virtual void OnPinkyFingertipTouchColliderOverlapEnds( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex); }; \ No newline at end of file