Compare commits

...
2 Commits
Author SHA1 Message Date
Mamadou Babaei 702fdf19fa bump the plugin version to v1.8.0 2023-10-10 16:12:51 +02:00
Mamadou Babaei 0364f67ae2 This single commit inroduces the following changes:
- Introduced new SGPawn events: OnActorGrabbed, OnActorReleased, OnActorBeginTouch, and OnActorEndTouch.
- Exposed OnGrabStateUpdated, OnTouchStateUpdated, OnActorGrabbed, OnActorReleased, OnActorBeginTouch, and OnActorEndTouch events to Blueprint as BlueprintImplementableEvent.

- Fix a bug where the OnTouchStateUpdated event is mistakenly triggered instead of the OnGrabStateUpdated when the right thumb fingertip grab collider overlaps with a grabbable actor.
2023-10-10 16:12:50 +02:00
5 changed files with 167 additions and 38 deletions
+11
View File
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.8.0] - 2023-10-10
### Added
- Introduced new SGPawn events: OnActorGrabbed, OnActorReleased, OnActorBeginTouch, and OnActorEndTouch.
- Exposed OnGrabStateUpdated, OnTouchStateUpdated, OnActorGrabbed, OnActorReleased, OnActorBeginTouch, and OnActorEndTouch events to Blueprint as BlueprintImplementableEvent.
### Fixed
- Fix a bug where the OnTouchStateUpdated event is mistakenly triggered instead of the OnGrabStateUpdated when the right thumb fingertip grab collider overlaps with a grabbable actor.
## [1.7.0] - 2023-09-14 ## [1.7.0] - 2023-09-14
### Added ### Added
+3 -3
View File
@@ -15,9 +15,9 @@ This repository relies on Git LFS for storing binary blobs (e.g. third-party lib
| **4.26** | ⚠️ v1.0.x | ⚠️ v1.0.x | ❌ | ⚠️ v1.0.x | ❌ | ❌ | ❌ | ⚠️ v1.0.4 | | **4.26** | ⚠️ v1.0.x | ⚠️ v1.0.x | ❌ | ⚠️ v1.0.x | ❌ | ❌ | ❌ | ⚠️ v1.0.4 |
| **4.27** | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x (r21e) | ⚠️ v1.3.1 | ⚠️ v1.4.3 | | **4.27** | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x | ⚠️ v1.4.x (r21e) | ⚠️ v1.3.1 | ⚠️ v1.4.3 |
| **5.0** | ❌ | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x (r21e) | ⚠️ v1.6.1 | ⚠️ v1.6.1 | | **5.0** | ❌ | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x | ⚠️ v1.6.x (r21e) | ⚠️ v1.6.1 | ⚠️ v1.6.1 |
| **5.1** | ❌ | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x (r25b) | ✅ v1.7.0 | ✅ v1.7.0 | | **5.1** | ❌ | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x (r25b) | ✅ v1.8.0 | ✅ v1.8.0 |
| **5.2** | ❌ | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x (r25b) | ✅ v1.7.0 | ✅ v1.7.0 | | **5.2** | ❌ | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x (r25b) | ✅ v1.8.0 | ✅ v1.8.0 |
| **5.3** | ❌ | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x (r25b) | ✅ v1.7.0 | ✅ v1.7.0 | | **5.3** | ❌ | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x | ✅ v1.8.x (r25b) | ✅ v1.8.0 | ✅ v1.8.0 |
* <code>✅</code> Supported * <code>✅</code> Supported
* <code>⚠️</code> Not supported by the latest release and might be lacking features * <code>⚠️</code> Not supported by the latest release and might be lacking features
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"FileVersion": 3, "FileVersion": 3,
"Version": 1, "Version": 1,
"VersionName": "1.7.0", "VersionName": "1.8.0",
"FriendlyName": "SenseGlove", "FriendlyName": "SenseGlove",
"Description": "Integrating the SenseGlove haptic controller into Unreal Engine", "Description": "Integrating the SenseGlove haptic controller into Unreal Engine",
"Category": "Virtual Reality", "Category": "Virtual Reality",
@@ -145,6 +145,13 @@ struct ASGPawn::FImpl
void RecordHandVelocity(FSGGrabState& GrabState, const float DeltaSeconds) const; void RecordHandVelocity(FSGGrabState& GrabState, const float DeltaSeconds) const;
void Release(FSGGrabState& GrabState) const; void Release(FSGGrabState& GrabState) const;
void TriggerGrabStateUpdatedEvent(const FSGGrabState& GrabState) const;
void TriggerTouchStateUpdatedEvent(const FSGTouchState& TouchState) const;
void TriggerActorGrabbedEvent(const USGVirtualHandComponent* Hand, const AActor* Actor) const;
void TriggerActorReleasedEvent(const USGVirtualHandComponent* Hand, const AActor* Actor) const;
void TriggerBeginTouch(const USGVirtualHandComponent* Hand, const AActor* Actor) const;
void TriggerEndTouch(const USGVirtualHandComponent* Hand, const AActor* Actor) const;
}; };
ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer) ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
@@ -781,7 +788,7 @@ void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor)) if (USGGrabComponent::IsGrabbable(OtherActor))
{ {
LeftHandGrabState.ActorThumbCanGrab = OtherActor; LeftHandGrabState.ActorThumbCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(LeftHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
} }
} }
@@ -798,7 +805,7 @@ void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapEnds(
if (LeftHandGrabState.ActorThumbCanGrab == OtherActor) if (LeftHandGrabState.ActorThumbCanGrab == OtherActor)
{ {
LeftHandGrabState.ActorThumbCanGrab = nullptr; LeftHandGrabState.ActorThumbCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(LeftHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
} }
} }
@@ -819,7 +826,7 @@ void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor)) if (USGGrabComponent::IsGrabbable(OtherActor))
{ {
LeftHandGrabState.ActorIndexCanGrab = OtherActor; LeftHandGrabState.ActorIndexCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(LeftHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
} }
} }
@@ -836,7 +843,7 @@ void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapEnds(
if (LeftHandGrabState.ActorIndexCanGrab == OtherActor) if (LeftHandGrabState.ActorIndexCanGrab == OtherActor)
{ {
LeftHandGrabState.ActorIndexCanGrab = nullptr; LeftHandGrabState.ActorIndexCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(LeftHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
} }
} }
@@ -857,7 +864,7 @@ void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor)) if (USGGrabComponent::IsGrabbable(OtherActor))
{ {
LeftHandGrabState.ActorMiddleCanGrab = OtherActor; LeftHandGrabState.ActorMiddleCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(LeftHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
} }
} }
@@ -874,7 +881,7 @@ void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapEnds(
if (LeftHandGrabState.ActorMiddleCanGrab == OtherActor) if (LeftHandGrabState.ActorMiddleCanGrab == OtherActor)
{ {
LeftHandGrabState.ActorMiddleCanGrab = nullptr; LeftHandGrabState.ActorMiddleCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(LeftHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
} }
} }
@@ -895,7 +902,8 @@ void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
LeftHandTouchState.ActorThumbTouching = OtherActor; LeftHandTouchState.ActorThumbTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -912,7 +920,8 @@ void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapEnds(
if (LeftHandTouchState.ActorThumbTouching == OtherActor) if (LeftHandTouchState.ActorThumbTouching == OtherActor)
{ {
LeftHandTouchState.ActorThumbTouching = nullptr; LeftHandTouchState.ActorThumbTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -933,7 +942,8 @@ void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
LeftHandTouchState.ActorIndexTouching = OtherActor; LeftHandTouchState.ActorIndexTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -950,7 +960,8 @@ void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapEnds(
if (LeftHandTouchState.ActorIndexTouching == OtherActor) if (LeftHandTouchState.ActorIndexTouching == OtherActor)
{ {
LeftHandTouchState.ActorIndexTouching = nullptr; LeftHandTouchState.ActorIndexTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -971,7 +982,8 @@ void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
LeftHandTouchState.ActorMiddleTouching = OtherActor; LeftHandTouchState.ActorMiddleTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -988,7 +1000,8 @@ void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapEnds(
if (LeftHandTouchState.ActorMiddleTouching == OtherActor) if (LeftHandTouchState.ActorMiddleTouching == OtherActor)
{ {
LeftHandTouchState.ActorMiddleTouching = nullptr; LeftHandTouchState.ActorMiddleTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -1009,7 +1022,8 @@ void ASGPawn::OnLeftRingFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
LeftHandTouchState.ActorRingTouching = OtherActor; LeftHandTouchState.ActorRingTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -1026,7 +1040,8 @@ void ASGPawn::OnLeftRingFingertipTouchColliderOverlapEnds(
if (LeftHandTouchState.ActorRingTouching == OtherActor) if (LeftHandTouchState.ActorRingTouching == OtherActor)
{ {
LeftHandTouchState.ActorRingTouching = nullptr; LeftHandTouchState.ActorRingTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -1047,7 +1062,8 @@ void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
LeftHandTouchState.ActorPinkyTouching = OtherActor; LeftHandTouchState.ActorPinkyTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -1064,7 +1080,8 @@ void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapEnds(
if (LeftHandTouchState.ActorPinkyTouching == OtherActor) if (LeftHandTouchState.ActorPinkyTouching == OtherActor)
{ {
LeftHandTouchState.ActorPinkyTouching = nullptr; LeftHandTouchState.ActorPinkyTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
} }
} }
@@ -1085,7 +1102,7 @@ void ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor)) if (USGGrabComponent::IsGrabbable(OtherActor))
{ {
RightHandGrabState.ActorThumbCanGrab = OtherActor; RightHandGrabState.ActorThumbCanGrab = OtherActor;
TouchStateUpdatedEvent.Broadcast(LeftHandTouchState); Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
} }
} }
@@ -1102,7 +1119,7 @@ void ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds(
if (RightHandGrabState.ActorThumbCanGrab == OtherActor) if (RightHandGrabState.ActorThumbCanGrab == OtherActor)
{ {
RightHandGrabState.ActorThumbCanGrab = nullptr; RightHandGrabState.ActorThumbCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(RightHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
} }
} }
@@ -1123,7 +1140,7 @@ void ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor)) if (USGGrabComponent::IsGrabbable(OtherActor))
{ {
RightHandGrabState.ActorIndexCanGrab = OtherActor; RightHandGrabState.ActorIndexCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(RightHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
} }
} }
@@ -1140,7 +1157,7 @@ void ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds(
if (RightHandGrabState.ActorThumbCanGrab == OtherActor) if (RightHandGrabState.ActorThumbCanGrab == OtherActor)
{ {
RightHandGrabState.ActorIndexCanGrab = nullptr; RightHandGrabState.ActorIndexCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(RightHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
} }
} }
@@ -1161,7 +1178,7 @@ void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins(
if (USGGrabComponent::IsGrabbable(OtherActor)) if (USGGrabComponent::IsGrabbable(OtherActor))
{ {
RightHandGrabState.ActorMiddleCanGrab = OtherActor; RightHandGrabState.ActorMiddleCanGrab = OtherActor;
GrabStateUpdatedEvent.Broadcast(RightHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
} }
} }
@@ -1178,7 +1195,7 @@ void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds(
if (RightHandGrabState.ActorMiddleCanGrab == OtherActor) if (RightHandGrabState.ActorMiddleCanGrab == OtherActor)
{ {
RightHandGrabState.ActorMiddleCanGrab = nullptr; RightHandGrabState.ActorMiddleCanGrab = nullptr;
GrabStateUpdatedEvent.Broadcast(RightHandGrabState); Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
} }
} }
@@ -1199,7 +1216,8 @@ void ASGPawn::OnRightThumbFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
RightHandTouchState.ActorThumbTouching = OtherActor; RightHandTouchState.ActorThumbTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1216,7 +1234,8 @@ void ASGPawn::OnRightThumbFingertipTouchColliderOverlapEnds(
if (RightHandTouchState.ActorThumbTouching == OtherActor) if (RightHandTouchState.ActorThumbTouching == OtherActor)
{ {
RightHandTouchState.ActorThumbTouching = nullptr; RightHandTouchState.ActorThumbTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1237,7 +1256,8 @@ void ASGPawn::OnRightIndexFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
RightHandTouchState.ActorIndexTouching = OtherActor; RightHandTouchState.ActorIndexTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1254,7 +1274,8 @@ void ASGPawn::OnRightIndexFingertipTouchColliderOverlapEnds(
if (RightHandTouchState.ActorIndexTouching == OtherActor) if (RightHandTouchState.ActorIndexTouching == OtherActor)
{ {
RightHandTouchState.ActorIndexTouching = nullptr; RightHandTouchState.ActorIndexTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1275,7 +1296,8 @@ void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
RightHandTouchState.ActorMiddleTouching = OtherActor; RightHandTouchState.ActorMiddleTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1292,7 +1314,8 @@ void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapEnds(
if (RightHandTouchState.ActorMiddleTouching == OtherActor) if (RightHandTouchState.ActorMiddleTouching == OtherActor)
{ {
RightHandTouchState.ActorMiddleTouching = nullptr; RightHandTouchState.ActorMiddleTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1313,7 +1336,8 @@ void ASGPawn::OnRightRingFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
RightHandTouchState.ActorRingTouching = OtherActor; RightHandTouchState.ActorRingTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1330,7 +1354,8 @@ void ASGPawn::OnRightRingFingertipTouchColliderOverlapEnds(
if (RightHandTouchState.ActorRingTouching == OtherActor) if (RightHandTouchState.ActorRingTouching == OtherActor)
{ {
RightHandTouchState.ActorRingTouching = nullptr; RightHandTouchState.ActorRingTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1351,7 +1376,8 @@ void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapBegins(
if (USGTouchComponent::IsTouchable(OtherActor)) if (USGTouchComponent::IsTouchable(OtherActor))
{ {
RightHandTouchState.ActorPinkyTouching = OtherActor; RightHandTouchState.ActorPinkyTouching = OtherActor;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1368,7 +1394,8 @@ void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapEnds(
if (RightHandTouchState.ActorPinkyTouching == OtherActor) if (RightHandTouchState.ActorPinkyTouching == OtherActor)
{ {
RightHandTouchState.ActorPinkyTouching = nullptr; RightHandTouchState.ActorPinkyTouching = nullptr;
TouchStateUpdatedEvent.Broadcast(RightHandTouchState); Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
} }
} }
@@ -1471,6 +1498,8 @@ void ASGPawn::Grab(USGVirtualHandComponent* Hand, AActor* Actor)
Pimpl->SetLeftHandGrabbedActor(Actor); Pimpl->SetLeftHandGrabbedActor(Actor);
} }
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */ #endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
Pimpl->TriggerActorGrabbedEvent(Hand, Actor);
} }
void ASGPawn::ReleaseLeft() void ASGPawn::ReleaseLeft()
@@ -1924,6 +1953,44 @@ void ASGPawn::FImpl::Release(FSGGrabState& GrabState) const
ApplyHandVelocityToGrabbedActor(GrabState); ApplyHandVelocityToGrabbedActor(GrabState);
SetGrabbedActor(GrabState, nullptr); SetGrabbedActor(GrabState, nullptr);
TriggerActorReleasedEvent(GrabState.Hand, GrabState.GrabbedActor);
}
void ASGPawn::FImpl::TriggerGrabStateUpdatedEvent(const FSGGrabState& GrabState) const
{
Owner->GrabStateUpdatedEvent.Broadcast(GrabState);
Owner->OnGrabStateUpdated(GrabState);
}
void ASGPawn::FImpl::TriggerTouchStateUpdatedEvent(const FSGTouchState& TouchState) const
{
Owner->TouchStateUpdatedEvent.Broadcast(TouchState);
Owner->OnTouchStateUpdated(TouchState);
}
void ASGPawn::FImpl::TriggerActorGrabbedEvent(const USGVirtualHandComponent* Hand, const AActor* Actor) const
{
Owner->ActorGrabbedEvent.Broadcast(Hand, Actor);
Owner->OnActorGrabbed(Hand, Actor);
}
void ASGPawn::FImpl::TriggerActorReleasedEvent(const USGVirtualHandComponent* Hand, const AActor* Actor) const
{
Owner->ActorReleasedEvent.Broadcast(Hand, Actor);
Owner->OnActorReleased(Hand, Actor);
}
void ASGPawn::FImpl::TriggerBeginTouch(const USGVirtualHandComponent* Hand, const AActor* Actor) const
{
Owner->ActorBeginTouchEvent.Broadcast(Hand, Actor);
Owner->OnActorBeginTouch(Hand, Actor);
}
void ASGPawn::FImpl::TriggerEndTouch(const USGVirtualHandComponent* Hand, const AActor* Actor) const
{
Owner->ActorEndTouchEvent.Broadcast(Hand, Actor);
Owner->OnActorEndTouch(Hand, Actor);
} }
ASGPawn::FImpl::~FImpl() = default; ASGPawn::FImpl::~FImpl() = default;
@@ -58,23 +58,55 @@ class SENSEGLOVE_API ASGPawn : public APawn
GENERATED_UCLASS_BODY() GENERATED_UCLASS_BODY()
public: public:
DECLARE_EVENT_OneParam(ASGVirtualHandActor, FGrabStateUpdatedEvent, const FSGGrabState& GrabState); DECLARE_EVENT_OneParam(ASGPawn, FGrabStateUpdatedEvent, const FSGGrabState& GrabState);
FGrabStateUpdatedEvent& OnGrabStateUpdated() FGrabStateUpdatedEvent& OnGrabStateUpdated()
{ {
return GrabStateUpdatedEvent; return GrabStateUpdatedEvent;
}; };
DECLARE_EVENT_OneParam(ASGVirtualHandActor, FTouchStateUpdatedEvent, const FSGTouchState& TouchState) DECLARE_EVENT_OneParam(ASGPawn, FTouchStateUpdatedEvent, const FSGTouchState& TouchState)
FTouchStateUpdatedEvent& OnTouchStateUpdated() FTouchStateUpdatedEvent& OnTouchStateUpdated()
{ {
return TouchStateUpdatedEvent; return TouchStateUpdatedEvent;
}; };
DECLARE_EVENT_TwoParams(ASGPawn, FActorGrabbedEvent, const USGVirtualHandComponent* Hand, const AActor* Actor);
FActorGrabbedEvent& OnGrabbed()
{
return ActorGrabbedEvent;
};
DECLARE_EVENT_TwoParams(ASGPawn, FActorReleasedEvent, const USGVirtualHandComponent* Hand, const AActor* Actor);
FActorReleasedEvent& OnReleased()
{
return ActorReleasedEvent;
};
DECLARE_EVENT_TwoParams(ASGPawn, FActorBeginTouchEvent, const USGVirtualHandComponent* Hand, const AActor* Actor);
FActorBeginTouchEvent& OnActorBeginTouch()
{
return ActorBeginTouchEvent;
};
DECLARE_EVENT_TwoParams(ASGPawn, FActorEndTouchEvent, const USGVirtualHandComponent* Hand, const AActor* Actor);
FActorEndTouchEvent& OnActorEndTouch()
{
return ActorEndTouchEvent;
};
private: private:
FGrabStateUpdatedEvent GrabStateUpdatedEvent; FGrabStateUpdatedEvent GrabStateUpdatedEvent;
FTouchStateUpdatedEvent TouchStateUpdatedEvent; FTouchStateUpdatedEvent TouchStateUpdatedEvent;
FActorGrabbedEvent ActorGrabbedEvent;
FActorReleasedEvent ActorReleasedEvent;
FActorBeginTouchEvent ActorBeginTouchEvent;
FActorEndTouchEvent ActorEndTouchEvent;
private: private:
struct FImpl; struct FImpl;
@@ -182,6 +214,25 @@ private:
UPROPERTY(Transient) UPROPERTY(Transient)
TArray<const AActor*> RightHandOverlappedActors; TArray<const AActor*> RightHandOverlappedActors;
protected:
UFUNCTION(BlueprintImplementableEvent, Category="SenseGlove | Game Framework | Pawn")
void OnGrabStateUpdated(const FSGGrabState& GrabState);
UFUNCTION(BlueprintImplementableEvent, Category="SenseGlove | Game Framework | Pawn")
void OnTouchStateUpdated(const FSGTouchState& TouchState);
UFUNCTION(BlueprintImplementableEvent, Category="SenseGlove | Game Framework | Pawn")
void OnActorGrabbed(const USGVirtualHandComponent* Hand, const AActor* Actor);
UFUNCTION(BlueprintImplementableEvent, Category="SenseGlove | Game Framework | Pawn")
void OnActorReleased(const USGVirtualHandComponent* Hand, const AActor* Actor);
UFUNCTION(BlueprintImplementableEvent, Category="SenseGlove | Game Framework | Pawn")
void OnActorBeginTouch(const USGVirtualHandComponent* Hand, const AActor* Actor);
UFUNCTION(BlueprintImplementableEvent, Category="SenseGlove | Game Framework | Pawn")
void OnActorEndTouch(const USGVirtualHandComponent* Hand, const AActor* Actor);
public: public:
FORCEINLINE UCameraComponent* GetCamera() const FORCEINLINE UCameraComponent* GetCamera() const
{ {