add the grab/touch state update events

This commit is contained in:
Mamadou Babaei
2023-05-19 18:13:45 +02:00
parent 37a15b93cd
commit 5aec9088e7
4 changed files with 393 additions and 182 deletions
@@ -516,6 +516,8 @@ void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorLeftThumbCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(HandLeft, ActorLeftThumbCanGrab, ActorLeftIndexCanGrab, ActorLeftMiddleCanGrab);
}
}
@@ -532,6 +534,8 @@ void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapEnds(
if (ActorLeftThumbCanGrab == OtherActor)
{
ActorLeftThumbCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(HandLeft, ActorLeftThumbCanGrab, ActorLeftIndexCanGrab, ActorLeftMiddleCanGrab);
}
}
@@ -552,6 +556,8 @@ void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorLeftIndexCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(HandLeft, ActorLeftThumbCanGrab, ActorLeftIndexCanGrab, ActorLeftMiddleCanGrab);
}
}
@@ -568,6 +574,8 @@ void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapEnds(
if (ActorLeftIndexCanGrab == OtherActor)
{
ActorLeftIndexCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(HandLeft, ActorLeftThumbCanGrab, ActorLeftIndexCanGrab, ActorLeftMiddleCanGrab);
}
}
@@ -588,6 +596,8 @@ void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorLeftMiddleCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(HandLeft, ActorLeftThumbCanGrab, ActorLeftIndexCanGrab, ActorLeftMiddleCanGrab);
}
}
@@ -604,6 +614,8 @@ void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapEnds(
if (ActorLeftMiddleCanGrab == OtherActor)
{
ActorLeftMiddleCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(HandLeft, ActorLeftThumbCanGrab, ActorLeftIndexCanGrab, ActorLeftMiddleCanGrab);
}
}
@@ -624,6 +636,10 @@ void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorLeftThumbTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -640,6 +656,10 @@ void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapEnds(
if (ActorLeftThumbTouching == OtherActor)
{
ActorLeftThumbTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -660,6 +680,10 @@ void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorLeftIndexTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -676,6 +700,10 @@ void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapEnds(
if (ActorLeftIndexTouching == OtherActor)
{
ActorLeftIndexTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -696,6 +724,10 @@ void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorLeftMiddleTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -712,6 +744,10 @@ void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapEnds(
if (ActorLeftMiddleTouching == OtherActor)
{
ActorLeftMiddleTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -732,6 +768,10 @@ void ASGPawn::OnLeftRingFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorLeftRingTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -748,6 +788,10 @@ void ASGPawn::OnLeftRingFingertipTouchColliderOverlapEnds(
if (ActorLeftRingTouching == OtherActor)
{
ActorLeftRingTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -768,6 +812,10 @@ void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorLeftPinkyTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -784,6 +832,10 @@ void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapEnds(
if (ActorLeftPinkyTouching == OtherActor)
{
ActorLeftPinkyTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandLeft, ActorLeftThumbTouching, ActorLeftIndexTouching, ActorLeftMiddleTouching,
ActorLeftRingTouching, ActorLeftPinkyTouching);
}
}
@@ -804,6 +856,9 @@ void ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorRightThumbCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbCanGrab, ActorRightIndexCanGrab, ActorRightMiddleCanGrab);
}
}
@@ -820,6 +875,9 @@ void ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds(
if (ActorRightThumbCanGrab == OtherActor)
{
ActorRightThumbCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbCanGrab, ActorRightIndexCanGrab, ActorRightMiddleCanGrab);
}
}
@@ -840,6 +898,9 @@ void ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorRightIndexCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbCanGrab, ActorRightIndexCanGrab, ActorRightMiddleCanGrab);
}
}
@@ -856,6 +917,9 @@ void ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds(
if (ActorRightThumbCanGrab == OtherActor)
{
ActorRightIndexCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbCanGrab, ActorRightIndexCanGrab, ActorRightMiddleCanGrab);
}
}
@@ -876,6 +940,9 @@ void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorRightMiddleCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbCanGrab, ActorRightIndexCanGrab, ActorRightMiddleCanGrab);
}
}
@@ -892,6 +959,9 @@ void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds(
if (ActorRightMiddleCanGrab == OtherActor)
{
ActorRightMiddleCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbCanGrab, ActorRightIndexCanGrab, ActorRightMiddleCanGrab);
}
}
@@ -912,6 +982,10 @@ void ASGPawn::OnRightThumbFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorRightThumbTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -928,6 +1002,10 @@ void ASGPawn::OnRightThumbFingertipTouchColliderOverlapEnds(
if (ActorRightThumbTouching == OtherActor)
{
ActorRightThumbTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -948,6 +1026,10 @@ void ASGPawn::OnRightIndexFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorRightIndexTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -964,6 +1046,10 @@ void ASGPawn::OnRightIndexFingertipTouchColliderOverlapEnds(
if (ActorRightIndexTouching == OtherActor)
{
ActorRightIndexTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -984,6 +1070,10 @@ void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorRightMiddleTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -1000,6 +1090,10 @@ void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapEnds(
if (ActorRightMiddleTouching == OtherActor)
{
ActorRightMiddleTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -1020,6 +1114,10 @@ void ASGPawn::OnRightRingFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorRightRingTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -1036,6 +1134,10 @@ void ASGPawn::OnRightRingFingertipTouchColliderOverlapEnds(
if (ActorRightRingTouching == OtherActor)
{
ActorRightRingTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -1056,6 +1158,10 @@ void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorRightPinkyTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -1072,6 +1178,10 @@ void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapEnds(
if (ActorRightPinkyTouching == OtherActor)
{
ActorRightPinkyTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
HandRight, ActorRightThumbTouching, ActorRightIndexTouching, ActorRightMiddleTouching,
ActorRightRingTouching, ActorRightPinkyTouching);
}
}
@@ -315,6 +315,8 @@ void ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorThumbCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(VirtualHand, ActorThumbCanGrab, ActorIndexCanGrab, ActorMiddleCanGrab);
}
}
@@ -331,6 +333,8 @@ void ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapEnds(
if (ActorThumbCanGrab == OtherActor)
{
ActorThumbCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(VirtualHand, ActorThumbCanGrab, ActorIndexCanGrab, ActorMiddleCanGrab);
}
}
@@ -351,6 +355,8 @@ void ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorIndexCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(VirtualHand, ActorThumbCanGrab, ActorIndexCanGrab, ActorMiddleCanGrab);
}
}
@@ -367,6 +373,8 @@ void ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapEnds(
if (ActorIndexCanGrab == OtherActor)
{
ActorIndexCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(VirtualHand, ActorThumbCanGrab, ActorIndexCanGrab, ActorMiddleCanGrab);
}
}
@@ -387,6 +395,8 @@ void ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor))
{
ActorMiddleCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(VirtualHand, ActorThumbCanGrab, ActorIndexCanGrab, ActorMiddleCanGrab);
}
}
@@ -403,6 +413,8 @@ void ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapEnds(
if (ActorMiddleCanGrab == OtherActor)
{
ActorMiddleCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(VirtualHand, ActorThumbCanGrab, ActorIndexCanGrab, ActorMiddleCanGrab);
}
}
@@ -423,6 +435,10 @@ void ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorThumbTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -439,6 +455,10 @@ void ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapEnds(
if (ActorThumbTouching == OtherActor)
{
ActorThumbTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -459,6 +479,10 @@ void ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorIndexTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -475,6 +499,10 @@ void ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapEnds(
if (ActorIndexTouching == OtherActor)
{
ActorIndexTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -495,6 +523,10 @@ void ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorMiddleTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -511,6 +543,10 @@ void ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapEnds(
if (ActorMiddleTouching == OtherActor)
{
ActorMiddleTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -525,6 +561,10 @@ void ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorRingTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -541,6 +581,10 @@ void ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapEnds(
if (ActorRingTouching == OtherActor)
{
ActorRingTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -555,6 +599,10 @@ void ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor))
{
ActorPinkyTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -571,6 +619,10 @@ void ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapEnds(
if (ActorPinkyTouching == OtherActor)
{
ActorPinkyTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(
VirtualHand, ActorThumbTouching, ActorIndexTouching, ActorMiddleTouching,
ActorRingTouching, ActorPinkyTouching);
}
}
@@ -36,6 +36,7 @@
#pragma once
#include "GameFramework/Pawn.h"
#include "SenseGlove/Components/SGVirtualHandComponent.h"
#include "Templates/UniquePtr.h"
#include "SGPawn.generated.h"
@@ -51,6 +52,30 @@ class SENSEGLOVE_API ASGPawn : public APawn
{
GENERATED_UCLASS_BODY()
public:
DECLARE_EVENT_FourParams(
ASGPawn, FGrabStateUpdatedEvent, const USGVirtualHandComponent*,
const AActor* ActorThumbCanGrab, const AActor* ActorIndexCanGrab, const AActor* ActorMiddleCanGrab);
FGrabStateUpdatedEvent& OnGrabStateUpdated()
{
return GrabStateUpdatedEvent;
};
DECLARE_EVENT_SixParams(
ASGPawn, FTouchStateUpdatedEvent, const USGVirtualHandComponent*,
const AActor* ActorThumbTouching, const AActor* ActorIndexTouching, const AActor* ActorMiddleTouching,
const AActor* ActorRingTouching, const AActor* ActorPinkyTouching);
FTouchStateUpdatedEvent& OnTouchStateUpdated()
{
return TouchStateUpdatedEvent;
};
private:
FGrabStateUpdatedEvent GrabStateUpdatedEvent;
FTouchStateUpdatedEvent TouchStateUpdatedEvent;
private:
struct FImpl;
@@ -57,6 +57,30 @@ class SENSEGLOVE_API ASGVirtualHandActor : public AActor
{
GENERATED_UCLASS_BODY()
public:
DECLARE_EVENT_FourParams(
ASGVirtualHandActor, FGrabStateUpdatedEvent, const USGVirtualHandComponent*,
const AActor* ActorThumbCanGrab, const AActor* ActorIndexCanGrab, const AActor* ActorMiddleCanGrab);
FGrabStateUpdatedEvent& OnGrabStateUpdated()
{
return GrabStateUpdatedEvent;
};
DECLARE_EVENT_SixParams(
ASGVirtualHandActor, FTouchStateUpdatedEvent, const USGVirtualHandComponent*,
const AActor* ActorThumbTouching, const AActor* ActorIndexTouching, const AActor* ActorMiddleTouching,
const AActor* ActorRingTouching, const AActor* ActorPinkyTouching);
FTouchStateUpdatedEvent& OnTouchStateUpdated()
{
return TouchStateUpdatedEvent;
};
private:
FGrabStateUpdatedEvent GrabStateUpdatedEvent;
FTouchStateUpdatedEvent TouchStateUpdatedEvent;
private:
struct FImpl;