implement an optional feature in order to automatically stop all haptics on the end play event
This commit is contained in:
@@ -15,6 +15,7 @@ This release breaks ABI/API compatibility with the previous versions.
|
|||||||
- Added Linux AArch64 platform support.
|
- Added Linux AArch64 platform support.
|
||||||
- Added a new Grab component that can turn any actor into a grabbable object.
|
- Added a new Grab component that can turn any actor into a grabbable object.
|
||||||
- Added a new Touch component that enables haptic feedbacks such as Buzz and Force-Feedback commands.
|
- Added a new Touch component that enables haptic feedbacks such as Buzz and Force-Feedback commands.
|
||||||
|
- Added an optional feature in order to automatically stop all haptics on the EndPlay event, wherever the virtual hand component is used. By default, it's enabled.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,8 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
|
|||||||
|
|
||||||
bRight = true;
|
bRight = true;
|
||||||
|
|
||||||
|
bAutoStopAllHapticsOnEndPlay = true;
|
||||||
|
|
||||||
GrabSocketName = FName{TEXT("GrabPoint")};
|
GrabSocketName = FName{TEXT("GrabPoint")};
|
||||||
|
|
||||||
DefaultFingertipsGrabColliderSize = FVector{0.08f, 0.08f, 0.08f};
|
DefaultFingertipsGrabColliderSize = FVector{0.08f, 0.08f, 0.08f};
|
||||||
@@ -330,6 +332,11 @@ void USGVirtualHandComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
|||||||
{
|
{
|
||||||
Super::EndPlay(EndPlayReason);
|
Super::EndPlay(EndPlayReason);
|
||||||
|
|
||||||
|
if (IsValid(Glove) && AutoStopsAllHapticsOnEndPlay())
|
||||||
|
{
|
||||||
|
Glove->StopHaptics();
|
||||||
|
}
|
||||||
|
|
||||||
(void) Pimpl->UninitializeBackend();
|
(void) Pimpl->UninitializeBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -624,11 +631,6 @@ bool USGVirtualHandComponent::FImpl::InitializeBackend() const
|
|||||||
|
|
||||||
bool USGVirtualHandComponent::FImpl::UninitializeBackend() const
|
bool USGVirtualHandComponent::FImpl::UninitializeBackend() const
|
||||||
{
|
{
|
||||||
if (IsValid(Owner->Glove))
|
|
||||||
{
|
|
||||||
Owner->Glove->StopHaptics();
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE
|
// NOTE
|
||||||
// In Editor builds we should be avoiding dispose, since stopping the game in PIE mode, causes the virtual-hand
|
// In Editor builds we should be avoiding dispose, since stopping the game in PIE mode, causes the virtual-hand
|
||||||
// to disappear in the editor as the plugin won't be able to retrieve the glove status anymore.
|
// to disappear in the editor as the plugin won't be able to retrieve the glove status anymore.
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ private:
|
|||||||
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||||
uint8 bRight : 1;
|
uint8 bRight : 1;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category="SenseGlove | Haptics", meta=(AllowPrivateAccess="false"))
|
||||||
|
uint8 bAutoStopAllHapticsOnEndPlay : 1;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, Category="SenseGlove | Grab", meta=(AllowPrivateAccess="false"))
|
UPROPERTY(EditAnywhere, Category="SenseGlove | Grab", meta=(AllowPrivateAccess="false"))
|
||||||
FName GrabSocketName;
|
FName GrabSocketName;
|
||||||
|
|
||||||
@@ -147,6 +150,16 @@ public:
|
|||||||
|
|
||||||
void SetRight(const bool bInRight);
|
void SetRight(const bool bInRight);
|
||||||
|
|
||||||
|
FORCEINLINE bool AutoStopsAllHapticsOnEndPlay() const
|
||||||
|
{
|
||||||
|
return !!bAutoStopAllHapticsOnEndPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE void SetAutoStopAllHapticsOnEndPlay(const bool bInAutoStopAllHapticsOnEndPlay)
|
||||||
|
{
|
||||||
|
bAutoStopAllHapticsOnEndPlay = bInAutoStopAllHapticsOnEndPlay;
|
||||||
|
}
|
||||||
|
|
||||||
FORCEINLINE const FName& GetGrabSocketName() const
|
FORCEINLINE const FName& GetGrabSocketName() const
|
||||||
{
|
{
|
||||||
return GrabSocketName;
|
return GrabSocketName;
|
||||||
|
|||||||
@@ -78,6 +78,18 @@ void UVirtualHandComponentKismetLibrary::SetRight(USGVirtualHandComponent* Virtu
|
|||||||
VirtualHandComponent->SetRight(bInRight);
|
VirtualHandComponent->SetRight(bInRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UVirtualHandComponentKismetLibrary::AutoStopsAllHapticsOnEndPlay(
|
||||||
|
const USGVirtualHandComponent* VirtualHandComponent)
|
||||||
|
{
|
||||||
|
return VirtualHandComponent->AutoStopsAllHapticsOnEndPlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UVirtualHandComponentKismetLibrary::SetAutoStopAllHapticsOnEndPlay(USGVirtualHandComponent* VirtualHandComponent,
|
||||||
|
const bool bInAutoStopAllHapticsOnEndPlay)
|
||||||
|
{
|
||||||
|
VirtualHandComponent->SetAutoStopAllHapticsOnEndPlay(bInAutoStopAllHapticsOnEndPlay);
|
||||||
|
}
|
||||||
|
|
||||||
const FName& UVirtualHandComponentKismetLibrary::GetGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent)
|
const FName& UVirtualHandComponentKismetLibrary::GetGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent)
|
||||||
{
|
{
|
||||||
return VirtualHandComponent->GetGrabSocketName();
|
return VirtualHandComponent->GetGrabSocketName();
|
||||||
|
|||||||
@@ -81,6 +81,13 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component")
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component")
|
||||||
static void SetRight(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, bool bInRight);
|
static void SetRight(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent, bool bInRight);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
|
||||||
|
static bool AutoStopsAllHapticsOnEndPlay(const USGVirtualHandComponent* VirtualHandComponent);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component")
|
||||||
|
static void SetAutoStopAllHapticsOnEndPlay(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent,
|
||||||
|
const bool bInAutoStopAllHapticsOnEndPlay);
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
|
||||||
static const FName& GetGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent);
|
static const FName& GetGrabSocketName(const USGVirtualHandComponent* VirtualHandComponent);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user