750 lines
24 KiB
C++
750 lines
24 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2026 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 "GameFramework/Pawn.h"
|
|
#include "Runtime/Launch/Resources/Version.h"
|
|
#include "Templates/UniquePtr.h"
|
|
|
|
#include "SenseGlove/Haptics/SGGrabState.h"
|
|
#include "SenseGlove/Haptics/SGTouchState.h"
|
|
|
|
#include "SGPawn.generated.h"
|
|
|
|
class UCameraComponent;
|
|
class UPrimitiveComponent;
|
|
class USphereComponent;
|
|
class UXRDeviceVisualizationComponent;
|
|
|
|
class USGVirtualHandComponent;
|
|
class USGWristTrackerComponent;
|
|
|
|
UCLASS(Config=Game, BlueprintType, Blueprintable)
|
|
class SENSEGLOVE_API ASGPawn : public APawn
|
|
{
|
|
GENERATED_UCLASS_BODY()
|
|
|
|
public:
|
|
DECLARE_EVENT_OneParam(ASGPawn, FGrabStateUpdatedEvent, const FSGGrabState& GrabState);
|
|
|
|
FGrabStateUpdatedEvent& OnGrabStateUpdated()
|
|
{
|
|
return GrabStateUpdatedEvent;
|
|
};
|
|
|
|
DECLARE_EVENT_OneParam(ASGPawn, FTouchStateUpdatedEvent, const FSGTouchState& TouchState)
|
|
|
|
FTouchStateUpdatedEvent& OnTouchStateUpdated()
|
|
{
|
|
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:
|
|
FGrabStateUpdatedEvent GrabStateUpdatedEvent;
|
|
FTouchStateUpdatedEvent TouchStateUpdatedEvent;
|
|
FActorGrabbedEvent ActorGrabbedEvent;
|
|
FActorReleasedEvent ActorReleasedEvent;
|
|
FActorBeginTouchEvent ActorBeginTouchEvent;
|
|
FActorEndTouchEvent ActorEndTouchEvent;
|
|
|
|
private:
|
|
struct FImpl;
|
|
|
|
struct FImplDeleter
|
|
{
|
|
void operator()(const FImpl* P) const;
|
|
};
|
|
|
|
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
|
FImplDeleter PimplDeleter;
|
|
|
|
private:
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USceneComponent* SceneRoot;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
UCameraComponent* Camera;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USGWristTrackerComponent* WristTrackerLeft;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
UXRDeviceVisualizationComponent* ControllerVisualizerLeft;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USGVirtualHandComponent* HandLeft;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USGVirtualHandComponent* RealHandLeft;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* LeftThumbFingertipGrabCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* LeftIndexFingertipGrabCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* LeftMiddleFingertipGrabCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* LeftThumbFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* LeftIndexFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* LeftMiddleFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* LeftRingFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* LeftPinkyFingertipTouchCollider;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USGWristTrackerComponent* WristTrackerRight;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
UXRDeviceVisualizationComponent* ControllerVisualizerRight;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USGVirtualHandComponent* HandRight;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USGVirtualHandComponent* RealHandRight;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* RightThumbFingertipGrabCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* RightIndexFingertipGrabCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* RightMiddleFingertipGrabCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* RightThumbFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* RightIndexFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* RightMiddleFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* RightRingFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
USphereComponent* RightPinkyFingertipTouchCollider;
|
|
|
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
|
int32 MaxNumberOfHandVelocitySamples;
|
|
|
|
private:
|
|
UPROPERTY(Transient)
|
|
FSGGrabState LeftHandGrabState;
|
|
|
|
UPROPERTY(Transient)
|
|
FSGTouchState LeftHandTouchState;
|
|
|
|
UPROPERTY(Transient)
|
|
FSGGrabState RightHandGrabState;
|
|
|
|
UPROPERTY(Transient)
|
|
FSGTouchState RightHandTouchState;
|
|
|
|
UPROPERTY(Transient)
|
|
TArray<const AActor*> LeftHandOverlappedActors;
|
|
|
|
UPROPERTY(Transient)
|
|
TArray<const AActor*> RightHandOverlappedActors;
|
|
|
|
protected:
|
|
UFUNCTION(BlueprintNativeEvent, Category="SenseGlove | Game Framework | Pawn")
|
|
void OnGrabStateUpdated(const FSGGrabState& GrabState);
|
|
|
|
UFUNCTION(BlueprintNativeEvent, Category="SenseGlove | Game Framework | Pawn")
|
|
void OnTouchStateUpdated(const FSGTouchState& TouchState);
|
|
|
|
UFUNCTION(BlueprintNativeEvent, Category="SenseGlove | Game Framework | Pawn")
|
|
void OnActorGrabbed(const USGVirtualHandComponent* Hand, const AActor* Actor);
|
|
|
|
UFUNCTION(BlueprintNativeEvent, Category="SenseGlove | Game Framework | Pawn")
|
|
void OnActorReleased(const USGVirtualHandComponent* Hand, const AActor* Actor);
|
|
|
|
UFUNCTION(BlueprintNativeEvent, Category="SenseGlove | Game Framework | Pawn")
|
|
void OnActorBeginTouch(const USGVirtualHandComponent* Hand, const AActor* Actor);
|
|
|
|
UFUNCTION(BlueprintNativeEvent, Category="SenseGlove | Game Framework | Pawn")
|
|
void OnActorEndTouch(const USGVirtualHandComponent* Hand, const AActor* Actor);
|
|
|
|
public:
|
|
FORCEINLINE UCameraComponent* GetCamera() const
|
|
{
|
|
return Camera;
|
|
}
|
|
|
|
FORCEINLINE USGWristTrackerComponent* GetWristTrackerLeft() const
|
|
{
|
|
return WristTrackerLeft;
|
|
}
|
|
|
|
FORCEINLINE UXRDeviceVisualizationComponent* GetControllerVisualizerLeft() const
|
|
{
|
|
return ControllerVisualizerLeft;
|
|
}
|
|
|
|
FORCEINLINE USGVirtualHandComponent* GetHandLeft() const
|
|
{
|
|
return HandLeft;
|
|
}
|
|
|
|
FORCEINLINE USGVirtualHandComponent* GetRealHandLeft() const
|
|
{
|
|
return RealHandLeft;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetLeftThumbFingertipGrabCollider() const
|
|
{
|
|
return LeftThumbFingertipGrabCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetLeftIndexFingertipGrabCollider() const
|
|
{
|
|
return LeftIndexFingertipGrabCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetLeftMiddleFingertipGrabCollider() const
|
|
{
|
|
return LeftMiddleFingertipGrabCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetLeftThumbFingertipTouchCollider() const
|
|
{
|
|
return LeftThumbFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetLeftIndexFingertipTouchCollider() const
|
|
{
|
|
return LeftIndexFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetLeftMiddleFingertipTouchCollider() const
|
|
{
|
|
return LeftMiddleFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetLeftRingFingertipTouchCollider() const
|
|
{
|
|
return LeftRingFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetLeftPinkyFingertipTouchCollider() const
|
|
{
|
|
return LeftPinkyFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USGWristTrackerComponent* GetWristTrackerRight() const
|
|
{
|
|
return WristTrackerRight;
|
|
}
|
|
|
|
FORCEINLINE UXRDeviceVisualizationComponent* GetControllerVisualizerRight() const
|
|
{
|
|
return ControllerVisualizerLeft;
|
|
}
|
|
|
|
FORCEINLINE USGVirtualHandComponent* GetHandRight() const
|
|
{
|
|
return HandRight;
|
|
}
|
|
|
|
FORCEINLINE USGVirtualHandComponent* GetRealHandRight() const
|
|
{
|
|
return RealHandRight;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetRightThumbFingertipGrabCollider() const
|
|
{
|
|
return RightThumbFingertipGrabCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetRightIndexFingertipGrabCollider() const
|
|
{
|
|
return RightIndexFingertipGrabCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetRightMiddleFingertipGrabCollider() const
|
|
{
|
|
return RightMiddleFingertipGrabCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetRightThumbFingertipTouchCollider() const
|
|
{
|
|
return RightThumbFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetRightIndexFingertipTouchCollider() const
|
|
{
|
|
return RightIndexFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetRightMiddleFingertipTouchCollider() const
|
|
{
|
|
return RightMiddleFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetRightRingFingertipTouchCollider() const
|
|
{
|
|
return RightRingFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE USphereComponent* GetRightPinkyFingertipTouchCollider() const
|
|
{
|
|
return RightPinkyFingertipTouchCollider;
|
|
}
|
|
|
|
FORCEINLINE int32 GetMaxNumberOfHandVelocitySamples() const
|
|
{
|
|
return MaxNumberOfHandVelocitySamples;
|
|
}
|
|
|
|
FORCEINLINE void SetMaxNumberOfHandVelocitySamples(const int32 InMaxNumberOfHandVelocitySamples)
|
|
{
|
|
MaxNumberOfHandVelocitySamples = InMaxNumberOfHandVelocitySamples;
|
|
}
|
|
|
|
public:
|
|
virtual void BeginPlay() override;
|
|
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
|
virtual void Tick(float DeltaSeconds) override;
|
|
virtual void PreInitializeComponents() override;
|
|
virtual void PostInitializeComponents() override;
|
|
|
|
protected:
|
|
UFUNCTION()
|
|
virtual void OnRealLeftHandOverlapBegins(
|
|
UPrimitiveComponent* OverlappedComponent,
|
|
AActor* OtherActor,
|
|
UPrimitiveComponent* OtherComp,
|
|
int32 OtherBodyIndex,
|
|
bool bFromSweep,
|
|
const FHitResult& SweepResult);
|
|
|
|
UFUNCTION()
|
|
virtual void OnRealLeftHandOverlapEnds(
|
|
UPrimitiveComponent* OverlappedComponent,
|
|
AActor* OtherActor,
|
|
UPrimitiveComponent* OtherComp,
|
|
int32 OtherBodyIndex);
|
|
|
|
UFUNCTION()
|
|
virtual void OnRealRightHandOverlapBegins(
|
|
UPrimitiveComponent* OverlappedComponent,
|
|
AActor* OtherActor,
|
|
UPrimitiveComponent* OtherComp,
|
|
int32 OtherBodyIndex,
|
|
bool bFromSweep,
|
|
const FHitResult& SweepResult);
|
|
|
|
UFUNCTION()
|
|
virtual void OnRealRightHandOverlapEnds(
|
|
UPrimitiveComponent* OverlappedComponent,
|
|
AActor* OtherActor,
|
|
UPrimitiveComponent* OtherComp,
|
|
int32 OtherBodyIndex);
|
|
|
|
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);
|
|
|
|
public:
|
|
FORCEINLINE bool CanLeftHandGrab(const AActor* Actor) const
|
|
{
|
|
return !IsLeftHandGrabbing() && ((IsValid(Actor) && Actor == LeftHandGrabState.ActorThumbCanGrab)
|
|
&& (Actor == LeftHandGrabState.ActorIndexCanGrab || Actor == LeftHandGrabState.ActorMiddleCanGrab));
|
|
}
|
|
|
|
FORCEINLINE bool IsLeftHandGrabbing(const AActor* Actor) const
|
|
{
|
|
return IsValid(Actor) && LeftHandGrabState.GrabbedActor == Actor;
|
|
}
|
|
|
|
bool IsLeftHandGrabbing(AActor*& OutActor) const;
|
|
|
|
FORCEINLINE bool IsLeftHandGrabbing() const
|
|
{
|
|
return IsValid(LeftHandGrabState.GrabbedActor);
|
|
}
|
|
|
|
FORCEINLINE bool CanRightHandGrab(const AActor* Actor) const
|
|
{
|
|
return !IsRightHandGrabbing() && ((IsValid(Actor) && Actor == RightHandGrabState.ActorThumbCanGrab)
|
|
&& (Actor == RightHandGrabState.ActorIndexCanGrab || Actor == RightHandGrabState.ActorMiddleCanGrab));
|
|
}
|
|
|
|
FORCEINLINE bool IsRightHandGrabbing(const AActor* Actor) const
|
|
{
|
|
return IsValid(Actor) && RightHandGrabState.GrabbedActor == Actor;
|
|
}
|
|
|
|
FORCEINLINE bool IsRightHandGrabbing() const
|
|
{
|
|
return IsValid(RightHandGrabState.GrabbedActor);
|
|
}
|
|
|
|
bool IsRightHandGrabbing(AActor*& OutActor) const;
|
|
|
|
FORCEINLINE bool CanGrab(const USGVirtualHandComponent* Hand, const AActor* Actor) const
|
|
{
|
|
return Hand == HandRight ? CanRightHandGrab(Actor) : CanLeftHandGrab(Actor);
|
|
}
|
|
|
|
FORCEINLINE bool IsGrabbing(const USGVirtualHandComponent* Hand, const AActor* Actor) const
|
|
{
|
|
return Hand == HandRight ? IsRightHandGrabbing(Actor) : IsLeftHandGrabbing(Actor);
|
|
}
|
|
|
|
bool IsGrabbing(const USGVirtualHandComponent* Hand, AActor*& OutActor) const;
|
|
|
|
FORCEINLINE bool IsGrabbing(const USGVirtualHandComponent* Hand) const
|
|
{
|
|
return Hand == HandRight ? IsRightHandGrabbing() : IsLeftHandGrabbing();
|
|
}
|
|
|
|
public:
|
|
FORCEINLINE void GrabLeft(AActor* Actor)
|
|
{
|
|
Grab(HandLeft, Actor);
|
|
}
|
|
|
|
FORCEINLINE void GrabRight(AActor* Actor)
|
|
{
|
|
Grab(HandRight, Actor);
|
|
}
|
|
|
|
void Grab(USGVirtualHandComponent* Hand, AActor* Actor);
|
|
|
|
void ReleaseLeft();
|
|
|
|
void ReleaseRight();
|
|
|
|
FORCEINLINE void Release(const USGVirtualHandComponent* Hand)
|
|
{
|
|
return Hand == HandRight ? ReleaseRight() : ReleaseLeft();
|
|
}
|
|
}; |