diff --git a/CHANGELOG.md b/CHANGELOG.md index ddafdb2c..a77d7aee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ This is a bugfix release addressing mostly RunUAT build issues on Unreal Engine ### Removed - Dropped support for Unreal Engine 5.1 and Epic Native Toolchain v20 (used to build UE 5.0 and 5.1 Linux dependencies). +- Removed ASGVirtualHandActor as it was experimental and we no longer maintain it and haven't been doing so for a long time. ## [2.0.2] - 2024-04-25 diff --git a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp b/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp deleted file mode 100644 index 3b8440b7..00000000 --- a/Source/SenseGlove/Private/SenseGlove/GameFramework/SGVirtualHandActor.cpp +++ /dev/null @@ -1,703 +0,0 @@ -/** - * @file - * - * @author Mamadou Babaei - * - * @section LICENSE - * - * (The MIT License) - * - * Copyright (c) 2020 - 2024 SenseGlove - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * @section DESCRIPTION - * - * - */ - - -#include "SenseGlove/GameFramework/SGVirtualHandActor.h" - -#include "Components/SphereComponent.h" - -#include "SenseGlove/Components/SGGrabComponent.h" -#include "SenseGlove/Components/SGTouchComponent.h" -#include "SenseGlove/Components/SGVirtualHandComponent.h" -#include "SenseGlove/Components/SGWristTrackerComponent.h" - -struct ASGVirtualHandActor::FImpl -{ - /************************ - * Owner object - ************************/ - - ASGVirtualHandActor* Owner; - - /************************ - * Constructor / Destructor - ************************/ - - explicit FImpl(ASGVirtualHandActor* InOwner); - ~FImpl(); - - /************************ - * Default copy constructor & copy assignment operator - ************************/ - - FImpl(const FImpl& Rhs) = default; - FImpl& operator=(const FImpl& Rhs) = default; - - /************************ - * Methods - ************************/ - - void BindFingerGrabOverlapEvents(); - void UnbindFingerGrabOverlapEvents(); - - void BindFingerTouchOverlapEvents(); - void UnbindFingerTouchOverlapEvents(); - - bool IsFingerGrabbing(AActor* Actor) const; - bool IsFingerTouching(AActor* Actor) const; -}; - -ASGVirtualHandActor::ASGVirtualHandActor(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer), - Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) -{ - PrimaryActorTick.bCanEverTick = true; - - SceneRoot = CreateDefaultSubobject(TEXT("SceneRoot")); - SetRootComponent(SceneRoot); - - VirtualHand = CreateDefaultSubobject(TEXT("VirtualHand")); - VirtualHand->SetupAttachment(RootComponent); - VirtualHand->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f}, - false, nullptr, ETeleportType::None); - - ThumbFingertipGrabCollider = ObjectInitializer.CreateDefaultSubobject( - this, TEXT("ThumbFingertipGrabCollider")); - ThumbFingertipGrabCollider->SetupAttachment(VirtualHand, VirtualHand->GetThumbFingertipGrabSocketName()); - ThumbFingertipGrabCollider->SetRelativeScale3D(VirtualHand->GetDefaultFingertipsGrabColliderSize()); - ThumbFingertipGrabCollider->SetCastShadow(false); - ThumbFingertipGrabCollider->bCastDynamicShadow = false; - ThumbFingertipGrabCollider->SetReceivesDecals(true); - ThumbFingertipGrabCollider->SetCanEverAffectNavigation(false); - ThumbFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic); - ThumbFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); - ThumbFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap); - ThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap); - ThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap); - ThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); - ThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap); - ThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); - ThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap); - ThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap); - - IndexFingertipGrabCollider = ObjectInitializer.CreateDefaultSubobject( - this, TEXT("IndexFingertipGrabCollider")); - IndexFingertipGrabCollider->SetRelativeScale3D(VirtualHand->GetDefaultFingertipsGrabColliderSize()); - IndexFingertipGrabCollider->SetupAttachment(VirtualHand, VirtualHand->GetIndexFingertipGrabSocketName()); - IndexFingertipGrabCollider->SetCastShadow(false); - IndexFingertipGrabCollider->bCastDynamicShadow = false; - IndexFingertipGrabCollider->SetReceivesDecals(true); - IndexFingertipGrabCollider->SetCanEverAffectNavigation(false); - IndexFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic); - IndexFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); - IndexFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap); - IndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap); - IndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap); - IndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); - IndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap); - IndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); - IndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap); - IndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap); - - MiddleFingertipGrabCollider = ObjectInitializer.CreateDefaultSubobject( - this, TEXT("MiddleFingertipGrabCollider")); - MiddleFingertipGrabCollider->SetRelativeScale3D(VirtualHand->GetDefaultFingertipsGrabColliderSize()); - MiddleFingertipGrabCollider->SetupAttachment(VirtualHand, VirtualHand->GetMiddleFingertipGrabSocketName()); - MiddleFingertipGrabCollider->SetCastShadow(false); - MiddleFingertipGrabCollider->bCastDynamicShadow = false; - MiddleFingertipGrabCollider->SetReceivesDecals(true); - MiddleFingertipGrabCollider->SetCanEverAffectNavigation(false); - MiddleFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic); - MiddleFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); - MiddleFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap); - MiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap); - MiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap); - MiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); - MiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap); - MiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); - MiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap); - MiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap); - - ThumbFingertipTouchCollider = ObjectInitializer.CreateDefaultSubobject( - this, TEXT("ThumbFingertipTouchCollider")); - ThumbFingertipTouchCollider->SetupAttachment(VirtualHand, VirtualHand->GetThumbFingertipTouchSocketName()); - ThumbFingertipTouchCollider->SetRelativeScale3D(VirtualHand->GetDefaultFingertipsTouchColliderSize()); - ThumbFingertipTouchCollider->SetCastShadow(false); - ThumbFingertipTouchCollider->bCastDynamicShadow = false; - ThumbFingertipTouchCollider->SetReceivesDecals(true); - ThumbFingertipTouchCollider->SetCanEverAffectNavigation(false); - ThumbFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic); - ThumbFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); - ThumbFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap); - ThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap); - ThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap); - ThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); - ThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap); - ThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); - ThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap); - ThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap); - - IndexFingertipTouchCollider = ObjectInitializer.CreateDefaultSubobject( - this, TEXT("IndexFingertipTouchCollider")); - IndexFingertipTouchCollider->SetRelativeScale3D(VirtualHand->GetDefaultFingertipsTouchColliderSize()); - IndexFingertipTouchCollider->SetupAttachment(VirtualHand, VirtualHand->GetIndexFingertipTouchSocketName()); - IndexFingertipTouchCollider->SetCastShadow(false); - IndexFingertipTouchCollider->bCastDynamicShadow = false; - IndexFingertipTouchCollider->SetReceivesDecals(true); - IndexFingertipTouchCollider->SetCanEverAffectNavigation(false); - IndexFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic); - IndexFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); - IndexFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap); - IndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap); - IndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap); - IndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); - IndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap); - IndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); - IndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap); - IndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap); - - MiddleFingertipTouchCollider = ObjectInitializer.CreateDefaultSubobject( - this, TEXT("MiddleFingertipTouchCollider")); - MiddleFingertipTouchCollider->SetRelativeScale3D(VirtualHand->GetDefaultFingertipsTouchColliderSize()); - MiddleFingertipTouchCollider->SetupAttachment(VirtualHand, VirtualHand->GetMiddleFingertipTouchSocketName()); - MiddleFingertipTouchCollider->SetCastShadow(false); - MiddleFingertipTouchCollider->bCastDynamicShadow = false; - MiddleFingertipTouchCollider->SetReceivesDecals(true); - MiddleFingertipTouchCollider->SetCanEverAffectNavigation(false); - MiddleFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic); - MiddleFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); - MiddleFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap); - MiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap); - MiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap); - MiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); - MiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap); - MiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); - MiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap); - MiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap); - - RingFingertipTouchCollider = ObjectInitializer.CreateDefaultSubobject( - this, TEXT("RingFingertipTouchCollider")); - RingFingertipTouchCollider->SetRelativeScale3D(VirtualHand->GetDefaultFingertipsTouchColliderSize()); - RingFingertipTouchCollider->SetupAttachment(VirtualHand, VirtualHand->GetRingFingertipTouchSocketName()); - RingFingertipTouchCollider->SetCastShadow(false); - RingFingertipTouchCollider->bCastDynamicShadow = false; - RingFingertipTouchCollider->SetReceivesDecals(true); - RingFingertipTouchCollider->SetCanEverAffectNavigation(false); - RingFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic); - RingFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); - RingFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap); - RingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap); - RingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap); - RingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); - RingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap); - RingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); - RingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap); - RingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap); - - PinkyFingertipTouchCollider = ObjectInitializer.CreateDefaultSubobject( - this, TEXT("PinkyFingertipTouchCollider")); - PinkyFingertipTouchCollider->SetRelativeScale3D(VirtualHand->GetDefaultFingertipsTouchColliderSize()); - PinkyFingertipTouchCollider->SetupAttachment(VirtualHand, VirtualHand->GetPinkyFingertipTouchSocketName()); - PinkyFingertipTouchCollider->SetCastShadow(false); - PinkyFingertipTouchCollider->bCastDynamicShadow = false; - PinkyFingertipTouchCollider->SetReceivesDecals(true); - PinkyFingertipTouchCollider->SetCanEverAffectNavigation(false); - PinkyFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic); - PinkyFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); - PinkyFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap); - PinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap); - PinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap); - PinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); - PinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap); - PinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); - PinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap); - PinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap); - - WristTracker = CreateDefaultSubobject(TEXT("WristTracker")); - WristTracker->SetupAttachment(RootComponent); - - WristTracker->SetRight(VirtualHand->IsRight()); - - GrabState = FSGGrabState(VirtualHand, FVector::Zero(), {}, nullptr, nullptr, nullptr, nullptr); - TouchState = FSGTouchState(VirtualHand, nullptr, nullptr, nullptr, nullptr, nullptr); -} - -void ASGVirtualHandActor::BeginPlay() -{ - Super::BeginPlay(); - - ensureAlwaysMsgf( - (WristTracker->IsLeft() && VirtualHand->IsLeft()) - || (WristTracker->IsRight() && VirtualHand->IsRight()), - TEXT("The virtual hand component and the wrist tracker component do not track the same hand!")); - - WristTracker->OnWristLocationChanged().AddWeakLambda(this, [&](const FVector& Location)-> void - { - VirtualHand->SetWorldLocation(Location); - }); - - WristTracker->OnWristRotationChanged().AddWeakLambda(this, [&](const FRotator& Rotation)-> void - { - VirtualHand->SetWorldRotation(Rotation); - }); - - Pimpl->BindFingerGrabOverlapEvents(); - Pimpl->BindFingerTouchOverlapEvents(); -} - -void ASGVirtualHandActor::EndPlay(const EEndPlayReason::Type EndPlayReason) -{ - Super::EndPlay(EndPlayReason); - - Pimpl->UnbindFingerGrabOverlapEvents(); - Pimpl->UnbindFingerTouchOverlapEvents(); -} - -void ASGVirtualHandActor::PreInitializeComponents() -{ - Super::PreInitializeComponents(); - - WristTracker->SetRight(VirtualHand->IsRight()); -} - -void ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapBegins( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex, - const bool bFromSweep, - const FHitResult& SweepResult) -{ - (void) OverlappedComponent; - (void) OtherBodyIndex; - (void) bFromSweep; - (void) SweepResult; - - if (USGGrabComponent::IsGrabbable(OtherActor)) - { - GrabState.ActorThumbCanGrab = OtherActor; - GrabStateUpdatedEvent.Broadcast(GrabState); - } -} - -void ASGVirtualHandActor::OnThumbFingertipGrabColliderOverlapEnds( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex) -{ - (void) OverlappedComponent; - (void) OtherBodyIndex; - - if (GrabState.ActorThumbCanGrab == OtherActor) - { - GrabState.ActorThumbCanGrab = nullptr; - GrabStateUpdatedEvent.Broadcast(GrabState); - } -} - -void ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapBegins( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex, - const bool bFromSweep, - const FHitResult& SweepResult) -{ - (void) OverlappedComponent; - (void) OtherBodyIndex; - (void) bFromSweep; - (void) SweepResult; - - if (USGGrabComponent::IsGrabbable(OtherActor)) - { - GrabState.ActorIndexCanGrab = OtherActor; - GrabStateUpdatedEvent.Broadcast(GrabState); - } -} - -void ASGVirtualHandActor::OnIndexFingertipGrabColliderOverlapEnds( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex) -{ - (void) OverlappedComponent; - (void) OtherBodyIndex; - - if (GrabState.ActorIndexCanGrab == OtherActor) - { - GrabState.ActorIndexCanGrab = nullptr; - GrabStateUpdatedEvent.Broadcast(GrabState); - } -} - -void ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapBegins( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex, - const bool bFromSweep, - const FHitResult& SweepResult) -{ - (void) OverlappedComponent; - (void) OtherBodyIndex; - (void) bFromSweep; - (void) SweepResult; - - if (USGGrabComponent::IsGrabbable(OtherActor)) - { - GrabState.ActorMiddleCanGrab = OtherActor; - GrabStateUpdatedEvent.Broadcast(GrabState); - } -} - -void ASGVirtualHandActor::OnMiddleFingertipGrabColliderOverlapEnds( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex) -{ - (void) OverlappedComponent; - (void) OtherBodyIndex; - - if (GrabState.ActorMiddleCanGrab == OtherActor) - { - GrabState.ActorMiddleCanGrab = nullptr; - GrabStateUpdatedEvent.Broadcast(GrabState); - } -} - -void ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapBegins( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex, - const bool bFromSweep, - const FHitResult& SweepResult) -{ - (void) OverlappedComponent; - (void) OtherComp; - (void) OtherBodyIndex; - (void) bFromSweep; - (void) SweepResult; - - if (USGTouchComponent::IsTouchable(OtherActor)) - { - TouchState.ActorThumbTouching = OtherActor; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnThumbFingertipTouchColliderOverlapEnds( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex) -{ - (void) OverlappedComponent; - (void) OtherComp; - (void) OtherBodyIndex; - - if (TouchState.ActorThumbTouching == OtherActor) - { - TouchState.ActorThumbTouching = nullptr; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapBegins( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex, - const bool bFromSweep, - const FHitResult& SweepResult) -{ - (void) OverlappedComponent; - (void) OtherComp; - (void) OtherBodyIndex; - (void) bFromSweep; - (void) SweepResult; - - if (USGTouchComponent::IsTouchable(OtherActor)) - { - TouchState.ActorIndexTouching = OtherActor; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnIndexFingertipTouchColliderOverlapEnds( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex) -{ - (void) OverlappedComponent; - (void) OtherComp; - (void) OtherBodyIndex; - - if (TouchState.ActorIndexTouching == OtherActor) - { - TouchState.ActorIndexTouching = nullptr; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapBegins( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex, - const bool bFromSweep, - const FHitResult& SweepResult) -{ - (void) OverlappedComponent; - (void) OtherComp; - (void) OtherBodyIndex; - (void) bFromSweep; - (void) SweepResult; - - if (USGTouchComponent::IsTouchable(OtherActor)) - { - TouchState.ActorMiddleTouching = OtherActor; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnMiddleFingertipTouchColliderOverlapEnds( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex) -{ - (void) OverlappedComponent; - (void) OtherComp; - (void) OtherBodyIndex; - - if (TouchState.ActorMiddleTouching == OtherActor) - { - TouchState.ActorMiddleTouching = nullptr; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapBegins( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex, - const bool bFromSweep, - const FHitResult& SweepResult) -{ - if (USGTouchComponent::IsTouchable(OtherActor)) - { - TouchState.ActorRingTouching = OtherActor; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnRingFingertipTouchColliderOverlapEnds( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex) -{ - (void) OverlappedComponent; - (void) OtherComp; - (void) OtherBodyIndex; - - if (TouchState.ActorRingTouching == OtherActor) - { - TouchState.ActorRingTouching = nullptr; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapBegins( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex, - const bool bFromSweep, - const FHitResult& SweepResult) -{ - if (USGTouchComponent::IsTouchable(OtherActor)) - { - TouchState.ActorPinkyTouching = OtherActor; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -void ASGVirtualHandActor::OnPinkyFingertipTouchColliderOverlapEnds( - UPrimitiveComponent* OverlappedComponent, - AActor* OtherActor, - UPrimitiveComponent* OtherComp, - const int32 OtherBodyIndex) -{ - (void) OverlappedComponent; - (void) OtherComp; - (void) OtherBodyIndex; - - if (TouchState.ActorPinkyTouching == OtherActor) - { - TouchState.ActorPinkyTouching = nullptr; - TouchStateUpdatedEvent.Broadcast(TouchState); - } -} - -bool ASGVirtualHandActor::IsLeft() const -{ - return WristTracker->IsLeft() && VirtualHand->IsLeft(); -} - -bool ASGVirtualHandActor::IsRight() const -{ - return WristTracker->IsRight() && VirtualHand->IsRight(); -} - -void ASGVirtualHandActor::SetRight(const bool bRight) -{ - WristTracker->SetRight(bRight); - VirtualHand->SetRight(bRight); -} - -bool ASGVirtualHandActor::IsGloveConnected() const -{ - return VirtualHand->IsGloveConnected(); -} - -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 -{ - delete P; -} \ No newline at end of file diff --git a/Source/SenseGlove/Public/SenseGlove/GameFramework/SGVirtualHandActor.h b/Source/SenseGlove/Public/SenseGlove/GameFramework/SGVirtualHandActor.h deleted file mode 100644 index e48618a7..00000000 --- a/Source/SenseGlove/Public/SenseGlove/GameFramework/SGVirtualHandActor.h +++ /dev/null @@ -1,337 +0,0 @@ -/** - * @file - * - * @author Mamadou Babaei - * - * @section LICENSE - * - * (The MIT License) - * - * Copyright (c) 2020 - 2024 SenseGlove - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * @section DESCRIPTION - * - * - */ - - -#pragma once - -#include "Containers/Array.h" -#include "Containers/Map.h" -#include "GameFramework/Actor.h" -#include "Templates/UniquePtr.h" -#include "UObject/NameTypes.h" - -#include "SenseGlove/Haptics/SGGrabState.h" -#include "SenseGlove/Haptics/SGTouchState.h" - -#include "SGVirtualHandActor.generated.h" - -class USceneComponent; -class USkeletalMesh; -class USkeleton; -class USphereComponent; - -class USGHandPose; -class USGVirtualHandComponent; -class USGWristTrackerComponent; - -UCLASS(Config=Game, BlueprintType) -class SENSEGLOVE_API ASGVirtualHandActor : public AActor -{ - GENERATED_UCLASS_BODY() - -public: - DECLARE_EVENT_OneParam(ASGVirtualHandActor, FGrabStateUpdatedEvent, const FSGGrabState& GrabState); - - FGrabStateUpdatedEvent& OnGrabStateUpdated() - { - return GrabStateUpdatedEvent; - }; - - DECLARE_EVENT_OneParam(ASGVirtualHandActor, FTouchStateUpdatedEvent, const FSGTouchState& TouchState) - - FTouchStateUpdatedEvent& OnTouchStateUpdated() - { - return TouchStateUpdatedEvent; - }; - -private: - FGrabStateUpdatedEvent GrabStateUpdatedEvent; - FTouchStateUpdatedEvent TouchStateUpdatedEvent; - -private: - struct FImpl; - - struct FImplDeleter - { - void operator()(const FImpl* P) const; - }; - - TUniquePtr Pimpl; - FImplDeleter PimplDeleter; - -private: - UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USceneComponent* SceneRoot; - - UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USGWristTrackerComponent* WristTracker; - - UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USGVirtualHandComponent* VirtualHand; - - UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USphereComponent* ThumbFingertipGrabCollider; - - UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USphereComponent* IndexFingertipGrabCollider; - - UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USphereComponent* MiddleFingertipGrabCollider; - - UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USphereComponent* ThumbFingertipTouchCollider; - - UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USphereComponent* IndexFingertipTouchCollider; - - UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USphereComponent* MiddleFingertipTouchCollider; - - UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USphereComponent* RingFingertipTouchCollider; - - UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false")) - USphereComponent* PinkyFingertipTouchCollider; - -private: - UPROPERTY(Transient) - FSGGrabState GrabState; - - UPROPERTY(Transient) - FSGTouchState TouchState; - -public: - FORCEINLINE USGWristTrackerComponent* GetWristTracker() const - { - return WristTracker; - } - - FORCEINLINE USGVirtualHandComponent* GetVirtualHand() const - { - return VirtualHand; - } - - FORCEINLINE USphereComponent* GetThumbFingertipGrabCollider() const - { - return ThumbFingertipGrabCollider; - } - - FORCEINLINE USphereComponent* GetIndexFingertipGrabCollider() const - { - return IndexFingertipGrabCollider; - } - - FORCEINLINE USphereComponent* GetMiddleFingertipGrabCollider() const - { - return MiddleFingertipGrabCollider; - } - - FORCEINLINE USphereComponent* GetThumbFingertipTouchCollider() const - { - return ThumbFingertipTouchCollider; - } - - FORCEINLINE USphereComponent* GetIndexFingertipTouchCollider() const - { - return IndexFingertipTouchCollider; - } - - FORCEINLINE USphereComponent* GetMiddleFingertipTouchCollider() const - { - return MiddleFingertipTouchCollider; - } - - FORCEINLINE USphereComponent* GetRingFingertipTouchCollider() const - { - return RingFingertipTouchCollider; - } - - FORCEINLINE USphereComponent* GetPinkyFingertipTouchCollider() const - { - return PinkyFingertipTouchCollider; - } - -protected: - FORCEINLINE void SetMesh(USGVirtualHandComponent* InVirtualHand) - { - VirtualHand = InVirtualHand; - } - -public: - virtual void BeginPlay() override; - virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; - virtual void PreInitializeComponents() override; - -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); - -public: - bool IsLeft() const; - bool IsRight() const; - void SetRight(bool bRight); - - bool IsGloveConnected() const; - - FORCEINLINE bool CanGrab(const AActor* Actor) const - { - return ((IsValid(Actor) && Actor == GrabState.ActorThumbCanGrab) - && (Actor == GrabState.ActorIndexCanGrab || Actor == GrabState.ActorMiddleCanGrab)); - } -}; \ No newline at end of file diff --git a/Source/SenseGloveKismet/Private/SGKismet/SGVirtualHandActorKismetLibrary.cpp b/Source/SenseGloveKismet/Private/SGKismet/SGVirtualHandActorKismetLibrary.cpp deleted file mode 100644 index 0636ec34..00000000 --- a/Source/SenseGloveKismet/Private/SGKismet/SGVirtualHandActorKismetLibrary.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/** - * @file - * - * @author Mamadou Babaei - * - * @section LICENSE - * - * (The MIT License) - * - * Copyright (c) 2020 - 2024 SenseGlove - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * @section DESCRIPTION - * - * - */ - - -#include "SGKismet/SGVirtualHandActorKismetLibrary.h" - -#include "Components/SphereComponent.h" - -#include "SenseGlove/Components/SGVirtualHandComponent.h" -#include "SenseGlove/Components/SGWristTrackerComponent.h" -#include "SenseGlove/GameFramework/SGVirtualHandActor.h" - -USGWristTrackerComponent* UVirtualHandActorKismetLibrary::GetWristTracker(const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetWristTracker(); -} - -USGVirtualHandComponent* UVirtualHandActorKismetLibrary::GetVirtualHand(const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetVirtualHand(); -} - -USphereComponent* UVirtualHandActorKismetLibrary::GetThumbFingertipGrabCollider( - const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetThumbFingertipGrabCollider(); -} - -USphereComponent* UVirtualHandActorKismetLibrary::GetIndexFingertipGrabCollider( - const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetIndexFingertipGrabCollider(); -} - -USphereComponent* UVirtualHandActorKismetLibrary::GetMiddleFingertipGrabCollider( - const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetMiddleFingertipGrabCollider(); -} -USphereComponent* UVirtualHandActorKismetLibrary::GetThumbFingertipTouchCollider( - const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetThumbFingertipTouchCollider(); -} - -USphereComponent* UVirtualHandActorKismetLibrary::GetIndexFingertipTouchCollider( - const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetIndexFingertipTouchCollider(); -} - -USphereComponent* UVirtualHandActorKismetLibrary::GetMiddleFingertipTouchCollider( - const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetMiddleFingertipTouchCollider(); -} - -USphereComponent* UVirtualHandActorKismetLibrary::GetRingFingertipTouchCollider( - const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetRingFingertipTouchCollider(); -} - -USphereComponent* UVirtualHandActorKismetLibrary::GetPinkyFingertipTouchCollider( - const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->GetPinkyFingertipTouchCollider(); -} - -bool UVirtualHandActorKismetLibrary::IsLeft(const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->IsLeft(); -} - -bool UVirtualHandActorKismetLibrary::IsRight(const ASGVirtualHandActor* VirtualHandActor) -{ - return VirtualHandActor->IsRight(); -} - -void UVirtualHandActorKismetLibrary::SetRight(ASGVirtualHandActor* VirtualHandActor, const bool bRight) -{ - VirtualHandActor->SetRight(bRight); -} - -bool UVirtualHandActorKismetLibrary::IsGloveConnected(const ASGVirtualHandActor* VirtualHandActor) const -{ - return VirtualHandActor->IsGloveConnected(); -} \ No newline at end of file diff --git a/Source/SenseGloveKismet/Public/SGKismet/SGVirtualHandActorKismetLibrary.h b/Source/SenseGloveKismet/Public/SGKismet/SGVirtualHandActorKismetLibrary.h deleted file mode 100644 index 35d9ff74..00000000 --- a/Source/SenseGloveKismet/Public/SGKismet/SGVirtualHandActorKismetLibrary.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @file - * - * @author Mamadou Babaei - * - * @section LICENSE - * - * (The MIT License) - * - * Copyright (c) 2020 - 2024 SenseGlove - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * @section DESCRIPTION - * - * - */ - - -#pragma once - -#include "SGKismet/SGBlueprintFunctionLibrary.h" - -#include "SGVirtualHandActorKismetLibrary.generated.h" - -class USphereComponent; - -class ASGVirtualHandActor; -class USGVirtualHandComponent; -class USGWristTrackerComponent; - -UCLASS(meta=(ScriptName = "SesneGloveVirtualHandActorKismetLibrary")) -class SENSEGLOVEKISMET_API UVirtualHandActorKismetLibrary final : public USGBlueprintFunctionLibrary -{ - GENERATED_BODY() - -public: - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USGWristTrackerComponent* GetWristTracker(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USGVirtualHandComponent* GetVirtualHand(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USphereComponent* GetThumbFingertipGrabCollider(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USphereComponent* GetIndexFingertipGrabCollider(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USphereComponent* GetMiddleFingertipGrabCollider(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USphereComponent* GetThumbFingertipTouchCollider(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USphereComponent* GetIndexFingertipTouchCollider(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USphereComponent* GetMiddleFingertipTouchCollider(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USphereComponent* GetRingFingertipTouchCollider(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static USphereComponent* GetPinkyFingertipTouchCollider(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static bool IsLeft(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - static bool IsRight(const ASGVirtualHandActor* VirtualHandActor); - - UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Virtual Hand") - static void SetRight(UPARAM(ref) ASGVirtualHandActor* VirtualHandActor, bool bRight); - - UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Virtual Hand") - bool IsGloveConnected(const ASGVirtualHandActor* VirtualHandActor) const; -}; \ No newline at end of file