Compare commits

...
45 Commits
Author SHA1 Message Date
Mamadou Babaei 0efd382edb bump the plugin version to v1.7.0 2023-09-14 18:50:05 +02:00
Mamadou Babaei 28b88a5a72 bump senseglove headers and libraries for linux and android to v2.12.0-19c9854 2023-09-14 18:50:05 +02:00
Mamadou Babaei eab9892a5d bump senseglove libraries for windows to v2.12.0-19c9854 2023-09-14 18:50:04 +02:00
Mamadou Babaei da3449b7df move SGCoreImpl/SGPlatform to SGBuildHacks/SGPlatform and introduce SG_CPP20 and SG_CAPTURE_THIS 2023-09-14 18:50:04 +02:00
Mamadou Babaei 25e0d49eea update the changelog 2023-09-14 18:50:04 +02:00
Mamadou Babaei 01fe621704 update the changelog with unreleased changes 2023-09-14 18:50:04 +02:00
Mamadou Babaei ce325f1219 introduce senseglove backend and backend kismet modules in order to properly initialize the backend in order to avoid a bug where sgcoonect::init gets called every frame 2023-09-14 18:50:04 +02:00
Mamadou Babaei 8ce4caadc9 update the changelog with unreleased changes 2023-09-14 18:50:04 +02:00
Mamadou Babaei 2588eade1f remove a duplicate log 2023-09-14 18:50:04 +02:00
Mamadou Babaei 98921356cd add sggameinstance for future use 2023-09-14 18:50:04 +02:00
Mamadou Babaei 7a35364713 remove a duplicated slash in a header's path 2023-09-14 18:50:04 +02:00
Mamadou Babaei 1cac3a70e3 bump the plugin version to v1.6.1 2023-08-14 21:22:20 +02:00
Mamadou Babaei 083a1690e8 fix the platform support matrix 2023-08-14 21:22:19 +02:00
Mamadou Babaei c2244c8ff8 add a missing header that causes build issues on ue 5.0 2023-08-14 21:22:19 +02:00
Mamadou Babaei 8b7bcdd8b8 bump the plugin version to v1.6.0 2023-08-14 17:25:59 +02:00
Mamadou Babaei f0d67ce035 update the changelog 2023-08-14 17:25:59 +02:00
Mamadou Babaei 49bcfbc2d4 update the changelog 2023-08-14 17:25:58 +02:00
Mamadou Babaei 9ed0015db0 do not cache grabbed actors as overlapped actors 2023-08-14 17:25:58 +02:00
Mamadou Babaei 5951ac9c33 inline some pimpl methods in order to improve function call performance for regularly called methods 2023-08-14 17:25:57 +02:00
Mamadou Babaei be3647e310 cache all overlapped actors with the real/virtual hands 2023-08-14 17:25:57 +02:00
Mamadou Babaei 3e35246b39 initial working implementation of the separated virtual/real hand rendering 2023-08-14 17:25:56 +02:00
Mamadou Babaei 8087719bbb fix the wrong default gizmo colors when initialized using the default constructor. 2023-08-14 17:25:56 +02:00
Mamadou Babaei 5ca1da7730 fix ue 5.3 build issues 2023-08-14 17:25:55 +02:00
Mamadou Babaei 41196d69c1 add support for the upcoming unreal engine 5.3 and native toolchain v22 libs to the build system 2023-08-14 17:25:55 +02:00
Mamadou Babaei ead76bb4f5 bump senseglove libraries for windows to v2.11.0-b775a05 2023-08-14 17:25:54 +02:00
Mamadou Babaei 529e751e07 update the changelog 2023-08-14 17:25:53 +02:00
Mamadou Babaei 1b2300d18c remove any mention of msvc 2017 and ue 4.27 third-party libs from the readme file 2023-08-14 17:25:53 +02:00
Mamadou Babaei dbabec4583 bump senseglove headers and libraries for linux and android to v2.11.0-b775a05 2023-08-14 17:25:51 +02:00
Mamadou Babaei e1fea5d60b initial attempt at separating the hand rendering from the real hand 2023-08-14 17:25:50 +02:00
Mamadou Babaei 43bdec8601 alternative velocity calculation for released actors based on the hand's cached position history 2023-08-14 17:25:49 +02:00
Mamadou Babaei a5a8e7149f alternative velocity calculation for released actors based on a cached position history 2023-08-14 17:25:49 +02:00
Mamadou Babaei bb63748644 apply the hand's velocity to the grabbed actor after release 2023-08-14 17:25:48 +02:00
Mamadou Babaei d4e92546e3 bump the plugin version to v1.5.3 2023-07-19 18:22:49 +02:00
Mamadou Babaei daa4031e6b bump senseglove libraries for windows to v2.10.1-3b0e7c9 2023-07-19 18:22:48 +02:00
Mamadou Babaei bc39905bc6 a minor changelog fix 2023-07-19 18:22:47 +02:00
Mamadou Babaei 1fdb94d5c9 bump senseglove libraries for linux and android to v2.10.1-3b0e7c9 2023-07-19 18:22:47 +02:00
Mamadou Babaei 7c9e1b2462 bump the plugin version to v1.5.2 2023-07-19 01:19:59 +02:00
Mamadou Babaei ef6d5b6295 fix a build issue with android shipping builds 2023-07-19 01:13:21 +02:00
Mamadou Babaei 6794a36b0f whitespace fix 2023-07-19 01:13:20 +02:00
Mamadou Babaei 6c77fb0ca9 remove redundant whitespaces 2023-07-19 01:13:20 +02:00
Mamadou Babaei f5d9a02dab fix a grammatical error in the changelog 2023-07-19 01:13:19 +02:00
Mamadou Babaei 75eaea13a4 bump the plugin version to v1.5.1 2023-07-13 19:49:16 +02:00
Mamadou Babaei b2f89c4694 fix grab/release bug for the right hand 2023-07-13 17:27:28 +02:00
Mamadou Babaei b4e547f755 fix a wrist tracker bug where hands are getting tracked in reverse 2023-07-13 17:26:49 +02:00
Mamadou Babaei 8125ad2fc6 do checks against the right hand which is cleaner to read 2023-07-13 17:26:02 +02:00
151 changed files with 2170 additions and 538 deletions
+75 -1
View File
@@ -5,6 +5,80 @@ 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.7.0] - 2023-09-14
### Added
- Introduce SGGameInstance, a customized SenseGlove game instance for future use.
- Added the new SenseGloveBackend and SenseGloveBackendKismet modules.
- Added SG_CPP20 C++ macro for C++20 detection, which is now default from UE 5.3 onwards.
- Added SG_CAPTURE_THIS C++ macro as a workaround for error C4855: implicit capture of 'this' via '[=]' is deprecated in /std:c++20 in order to build the same lambda captures without extra #ifdefs on all supported engine versions.
### Changed
- SenseGlove libraries have been updated to v2.12.0-19c9854.
- SGCoreImpl/SGPlatform has been moved to SGBuildHacks/SGPlatform.
### Fixed
- Proper initialization of the SenseGlove backend in order to fix a bug in certain situations where SGConnect::Init() gets called every frame.
- Some other minor fixes and improvements.
## [1.6.1] - 2023-08-14
### Fixed
- Fix Unreal Engine 5.0 build issues.
- Minor documentation fixes.
## [1.6.0] - 2023-08-14
### Added
- Added support for the upcoming Unreal Engine 5.3.
- Now, the hand's velocity is applied to grabbed actors after being released from the hand.
- Introduce the real hands to the SenseGlove module (SGPawn) API.
- Added separation of the virtual and real hand rendering.
### Fixed
- Fix the wrong default debug virtual hand gizmo colors when initialized using the default constructor.
- Some minor performance fixes and improvements.
### Changed
- SenseGlove libraries have been updated to v2.11.0-b775a05.
## [1.5.3] - 2023-07-19
This is a hotfix release mostly addressing Android Bluetooth performance issues.
### Fixed
- Minor changelog fixes.
### Changed
- SenseGlove libraries have been updated to v2.10.1-3b0e7c9.
## [1.5.2] - 2023-07-19
This is a hotfix release mostly addressing Android-related issues.
### Fixed
- Fix a build issue with Android shipping builds due to sgconnect.jar not getting copied automatically in the AFSProject which is compiled for shipping builds when AndroidFileServer (AFS) is enabled.
- Minor changelog fixes and some source code formatting fixes.
## [1.5.1] - 2023-07-13
This is a hotfix release addressing a few critical issues introduced by the recent changes.
### Fixed
- Fix a wrist tracker bug where left and right hands' wrist trackers are mistakenly tracking the opposite hand's motion source.
- Fix a bug where the right hand is not able to do grab or release.
## [1.5.0] - 2023-06-16
This release breaks ABI/API compatibility with the previous versions in some areas as documented below.
@@ -22,7 +96,7 @@ This release breaks ABI/API compatibility with the previous versions in some are
### Changed
- Fully refactored the top-level configurations in the settings system into USTRUCTs.
- SenseGlove libraries have been updated to v.2.10.0-12133ac.
- SenseGlove libraries have been updated to v2.10.0-12133ac.
### Removed
+19 -24
View File
@@ -14,9 +14,10 @@ This repository relies on Git LFS for storing binary blobs (e.g. third-party lib
| **4.25** | ⚠️ 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 |
| **5.0** | ❌ | v1.5.x | v1.5.x | v1.5.x | v1.5.x | v1.5.x (r21e) | v1.5.0 | v1.5.0 |
| **5.1** | ❌ | ✅ v1.5.x | ✅ v1.5.x | ✅ v1.5.x | ✅ v1.5.x | ✅ v1.5.x (r25b) | ✅ v1.5.0 | ✅ v1.5.0 |
| **5.2** | ❌ | ✅ v1.5.x | ✅ v1.5.x | ✅ v1.5.x | ✅ v1.5.x | ✅ v1.5.x (r25b) | ✅ v1.5.0 | ✅ v1.5.0 |
| **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.2** | ❌ | ✅ 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.7.x | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x | ✅ v1.7.x (r25b) | ✅ v1.7.0 | ✅ v1.7.0 |
* <code>✅</code> Supported
* <code>⚠️</code> Not supported by the latest release and might be lacking features
@@ -173,20 +174,6 @@ Please note that modules postfixed with **Impl** are intended for interal use an
├── linux
│ │
│ ├── v19 (UE 4.27 Linux dependencies)
│ │ │
│ │ ├── aarch64 (dependencies targeting AArch64 Linux architecture)
│ │ │ │
│ │ │ ├── debug
│ │ │ │
│ │ │ └── release
│ │ │
│ │ └── x86-64 (dependencies targeting x86-64 Linux architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ ├── v20 (UE 5.0 and 5.1 Linux dependencies)
│ │ │
│ │ ├── aarch64 (dependencies targeting AArch64 Linux architecture)
@@ -201,7 +188,21 @@ Please note that modules postfixed with **Impl** are intended for interal use an
│ │ │
│ │ └── release
│ │
── v21 (UE 5.2 Linux dependencies)
── v21 (UE 5.2 Linux dependencies)
│ │ │
│ │ ├── aarch64 (dependencies targeting AArch64 Linux architecture)
│ │ │ │
│ │ │ ├── debug
│ │ │ │
│ │ │ └── release
│ │ │
│ │ └── x86-64 (dependencies targeting x86-64 Linux architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ └── v22 (UE 5.3 Linux dependencies)
│ │
│ ├── aarch64 (dependencies targeting AArch64 Linux architecture)
│ │ │
@@ -216,12 +217,6 @@ Please note that modules postfixed with **Impl** are intended for interal use an
│ └── release
└── win64
├── msvc141 (Microsoft Visual Studio 2017 dependencies)
│ │
│ ├── debug
│ │
│ └── release
├── msvc142 (Microsoft Visual Studio 2019 dependencies)
│ │
+23 -1
View File
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.5.0",
"VersionName": "1.7.0",
"FriendlyName": "SenseGlove",
"Description": "Integrating the SenseGlove haptic controller into Unreal Engine",
"Category": "Virtual Reality",
@@ -53,6 +53,28 @@
"Win64"
]
},
{
"Name": "SenseGloveBackend",
"Type": "Runtime",
"LoadingPhase": "PreDefault",
"WhitelistPlatforms": [
"Android",
"Linux",
"LinuxArm64",
"Win64"
]
},
{
"Name": "SenseGloveBackendKismet",
"Type": "Runtime",
"LoadingPhase": "PreDefault",
"WhitelistPlatforms": [
"Android",
"Linux",
"LinuxArm64",
"Win64"
]
},
{
"Name": "SenseGloveConnect",
"Type": "Runtime",
@@ -45,11 +45,9 @@
#include "SenseGlove/Animation/SGVirtualHandAnimInstance.h"
#include "SenseGlove/Components/SGWristTrackerComponent.h"
#include "SGConnect/SGConnect.h"
#include "SGCore/SGDeviceList.h"
#include "SGBackend/SGBackend.h"
#include "SGCore/SGHandPose.h"
#include "SGCore/SGHapticGlove.h"
#include "SGCore/SGHapticGloveHandProfiles.h"
#include "SGDebug/SGDebugVirtualHand.h"
#include "SGLog/SGLog.h"
@@ -123,11 +121,12 @@ struct USGVirtualHandComponent::FImpl
USkeleton* GetSkeleton() const;
const FReferenceSkeleton& GetRefSkeleton() const;
bool InitializeBackend() const;
bool UninitializeBackend() const;
bool CheckGlove() const;
void SetVisibility(bool bInVisible) const;
FORCEINLINE void SetVisibility(const bool bInVisible) const
{
Owner->SetVisibility(bInVisible, true);
}
void DrawDebugVirtualHand() const;
};
@@ -244,7 +243,6 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
Super::SetSkeletalMesh(nullptr, true);
bBackendInitialized = false;
Glove = nullptr;
WristTracker = nullptr;
}
@@ -306,27 +304,24 @@ void USGVirtualHandComponent::InitializeComponent()
Pimpl->SetDefaultMesh();
}
if (Pimpl->InitializeBackend())
{
(void) Pimpl->CheckGlove();
}
(void) Pimpl->CheckGlove();
}
void USGVirtualHandComponent::UninitializeComponent()
{
Super::UninitializeComponent();
(void) Pimpl->UninitializeBackend();
if (IsValid(Glove) && AutoStopsAllHapticsOnEndPlay())
{
Glove->StopHaptics();
}
}
void USGVirtualHandComponent::BeginPlay()
{
Super::BeginPlay();
if (Pimpl->InitializeBackend())
{
(void) Pimpl->CheckGlove();
}
(void) Pimpl->CheckGlove();
}
void USGVirtualHandComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
@@ -337,8 +332,6 @@ void USGVirtualHandComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Glove->StopHaptics();
}
(void) Pimpl->UninitializeBackend();
}
void USGVirtualHandComponent::TickComponent(
@@ -615,101 +608,11 @@ const FReferenceSkeleton& USGVirtualHandComponent::FImpl::GetRefSkeleton() const
return Mesh->GetRefSkeleton();
}
bool USGVirtualHandComponent::FImpl::InitializeBackend() const
{
if (!Owner->bBackendInitialized)
{
#if PLATFORM_ANDROID
const int32_t Result = FSGConnect::Init();
switch (Result)
{
case -3:
SGLOG_ERROR("An Unexpected error occurred. Please try again.");
return false;
case -2:
SGLOG_ERROR("Device Scanning is already running within a different program.");
return false;
case -1:
SGLOG_ERROR("Device Scanning already being initialized (function called twice in short succession).");
return false;
case 0:
// Do not pollute the logs!
//SGLOG_ERROR("Device Scanning is already running within this program.");
// We must return here in case there are two virtual hand components are present in the scene.
return true;
case 1:
SGLOG("Successfully started up DeviceScanning from the current program.");
break;
default:
ensureAlwaysMsgf(false, TEXT("Unhandled Init return status code!"));
return false;
}
#endif /* PLATFORM_ANDROID */
// Ensure that the device list is empty before doing anything.
FSGDeviceList::Dispose();
FSGDeviceList::Reinitialize();
// Load the latest hand profiles.
FSGHapticGloveHandProfiles::TryLoadingFromDisk();
Owner->bBackendInitialized = true;
return true;
}
return false;
}
bool USGVirtualHandComponent::FImpl::UninitializeBackend() const
{
// NOTE
// 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.
#if ! WITH_EDITOR
if (Owner->bBackendInitialized)
{
FSGDeviceList::Dispose();
#if PLATFORM_ANDROID
const int32_t Result = FSGConnect::Dispose();
switch (Result)
{
case -3:
SGLOG_ERROR("An Unexpected error occurred. Please try again.");
return false;
case -2:
SGLOG_ERROR("Not allowed to dispose of Device Scanning because this is not the program which started it.");
return false;
case -1:
SGLOG_ERROR("Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession).");
return false;
case 0:
SGLOG_ERROR("There is no deviceScanner running from any program, so disposing is skipped.");
return false;
case 1:
SGLOG("Successfully disposed of DeviceScanner resources.");
break;
default:
ensureAlwaysMsgf(false, TEXT("Unhandled Dispose return status code!"));
return false;
}
#endif /* PLATFORM_ANDROID */
Owner->bBackendInitialized = false;
return true;
}
#endif /* ! WITH_EDITOR */
return false;
}
bool USGVirtualHandComponent::FImpl::CheckGlove() const
{
if (!Owner->bBackendInitialized)
if (!USGBackend::GetInstance()->IsBackendInitialized())
{
const bool bSucceeded = InitializeBackend();
const bool bSucceeded = USGBackend::GetInstance()->InitializeBackend();
if (!bSucceeded)
{
return false;
@@ -758,11 +661,6 @@ bool USGVirtualHandComponent::FImpl::CheckGlove() const
return bFoundGlove;
}
void USGVirtualHandComponent::FImpl::SetVisibility(const bool bInVisible) const
{
Owner->SetVisibility(bInVisible, true);
}
void USGVirtualHandComponent::FImpl::DrawDebugVirtualHand() const
{
const UWorld* World{Owner->GetWorld()};
@@ -40,10 +40,8 @@
#include "Engine/SkeletalMesh.h"
#include "UObject/ConstructorHelpers.h"
#include "SGConnect/SGConnect.h"
#include "SGCore/SGDeviceList.h"
#include "SGBackend/SGBackend.h"
#include "SGCore/SGHapticGlove.h"
#include "SGCore/SGHapticGloveHandProfiles.h"
#include "SGDebug/SGDebugGizmo.h"
#include "SGLog/SGLog.h"
#include "SGSettings/SGSettings.h"
@@ -80,8 +78,6 @@ struct USGWristTrackerComponent::FImpl
bool IsEditor() const;
bool InitializeBackend() const;
bool UninitializeBackend() const;
bool CheckGlove() const;
void UpdateMotionSource() const;
@@ -128,7 +124,6 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
bRight = true;
bBackendInitialized = false;
Glove = nullptr;
WristLocation = FVector::ZeroVector;
WristRotation = FRotator::ZeroRotator;
@@ -184,40 +179,20 @@ void USGWristTrackerComponent::InitializeComponent()
{
Super::InitializeComponent();
if (Pimpl->InitializeBackend())
{
(void) Pimpl->CheckGlove();
}
(void) Pimpl->CheckGlove();
Pimpl->UpdateMotionSource();
}
void USGWristTrackerComponent::UninitializeComponent()
{
Super::UninitializeComponent();
(void) Pimpl->UninitializeBackend();
}
void USGWristTrackerComponent::BeginPlay()
{
Super::BeginPlay();
if (Pimpl->InitializeBackend())
{
(void) Pimpl->CheckGlove();
}
(void) Pimpl->CheckGlove();
Pimpl->UpdateMotionSource();
}
void USGWristTrackerComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
(void) Pimpl->UninitializeBackend();
}
void USGWristTrackerComponent::TickComponent(
const float DeltaTime, const ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
@@ -264,101 +239,11 @@ bool USGWristTrackerComponent::FImpl::IsEditor() const
return false;
}
bool USGWristTrackerComponent::FImpl::InitializeBackend() const
{
if (!Owner->bBackendInitialized)
{
#if PLATFORM_ANDROID
const int32_t Result = FSGConnect::Init();
switch (Result)
{
case -3:
SGLOG_ERROR("An Unexpected error occurred. Please try again.");
return false;
case -2:
SGLOG_ERROR("Device Scanning is already running within a different program.");
return false;
case -1:
SGLOG_ERROR("Device Scanning already being initialized (function called twice in short succession).");
return false;
case 0:
// Do not pollute the logs!
//SGLOG_ERROR("Device Scanning is already running within this program.");
// We must return here in case two virtual hand components are present in the scene.
return true;
case 1:
SGLOG("Successfully started up DeviceScanning from the current program.");
break;
default:
ensureAlwaysMsgf(false, TEXT("Unhandled Init return status code!"));
return false;
}
#endif /* PLATFORM_ANDROID */
// Ensure that the device list is empty before doing anything.
FSGDeviceList::Dispose();
FSGDeviceList::Reinitialize();
// Load the latest hand profiles.
FSGHapticGloveHandProfiles::TryLoadingFromDisk();
Owner->bBackendInitialized = true;
return true;
}
return false;
}
bool USGWristTrackerComponent::FImpl::UninitializeBackend() const
{
// NOTE
// 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.
#if ! WITH_EDITOR
if (Owner->bBackendInitialized)
{
FSGDeviceList::Dispose();
#if PLATFORM_ANDROID
const int32_t Result = FSGConnect::Dispose();
switch (Result)
{
case -3:
SGLOG_ERROR("An Unexpected error occurred. Please try again.");
return false;
case -2:
SGLOG_ERROR("Not allowed to dispose of Device Scanning because this is not the program which started it.");
return false;
case -1:
SGLOG_ERROR("Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession).");
return false;
case 0:
SGLOG_ERROR("There is no deviceScanner running from any program, so disposing is skipped.");
return false;
case 1:
SGLOG("Successfully disposed of DeviceScanner resources.");
break;
default:
ensureAlwaysMsgf(false, TEXT("Unhandled Dispose return status code!"));
return false;
}
#endif /* PLATFORM_ANDROID */
Owner->bBackendInitialized = false;
return true;
}
#endif /* ! WITH_EDITOR */
return false;
}
bool USGWristTrackerComponent::FImpl::CheckGlove() const
{
if (!Owner->bBackendInitialized)
if (!USGBackend::GetInstance()->IsBackendInitialized())
{
const bool bSucceeded = InitializeBackend();
const bool bSucceeded = USGBackend::GetInstance()->InitializeBackend();
if (!bSucceeded)
{
return false;
@@ -387,8 +272,8 @@ void USGWristTrackerComponent::FImpl::UpdateMotionSource() const
if (GEngine)
{
Owner->SetTrackingSource(Owner->IsRight()
? Owner->GetWristTrackingSettings().LeftHandMotionSource
: Owner->GetWristTrackingSettings().RightHandMotionSource);
? Owner->GetWristTrackingSettings().RightHandMotionSource
: Owner->GetWristTrackingSettings().LeftHandMotionSource);
}
}
@@ -0,0 +1,57 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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/Engine/SGGameInstance.h"
#include "SGLog/SGLog.h"
USGGameInstance::USGGameInstance(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
void USGGameInstance::Init()
{
Super::Init();
SGLOG("Initializing the SenseGlove GameInstance...")
}
void USGGameInstance::Shutdown()
{
Super::Shutdown();
SGLOG("Shutting down the SenseGlove GameInstance...")
}
@@ -33,7 +33,7 @@
*/
#include "SenseGlove/GameFramework//SGGameModeBase.h"
#include "SenseGlove/GameFramework/SGGameModeBase.h"
#include "SenseGlove/GameFramework/SGPawn.h"
#include "SenseGlove/GameFramework/SGPlayerController.h"
@@ -38,6 +38,8 @@
#include "Camera/CameraComponent.h"
#include "Components/PrimitiveComponent.h"
#include "Components/SphereComponent.h"
#include "Kismet/KismetMathLibrary.h"
#include "UObject/UObjectGlobals.h"
#include "SenseGlove/Components/SGGrabComponent.h"
#include "SenseGlove/Components/SGTouchComponent.h"
@@ -75,14 +77,74 @@ struct ASGPawn::FImpl
* Methods
************************/
void BindRealHandsOverlapEvents();
void UnbindRealHandsOverlapEvents();
void BindFingerGrabOverlapEvents();
void UnbindFingerGrabOverlapEvents();
void BindFingerTouchOverlapEvents();
void UnbindFingerTouchOverlapEvents();
void SetVisibility(USceneComponent* SceneComponent, const bool bVisibility) const;
void UpdateHandLocation(const bool bRight, const FVector& Location, const bool bUpdateVirtualHand);
void UpdateLeftHandLocation(const FVector& Location, const bool bUpdateVirtualHand);
void UpdateRightHandLocation(const FVector& Location, const bool bUpdateVirtualHand);
void UpdateHandRotation(const bool bRight, const FRotator& Rotation, const bool bUpdateVirtualHand);
void UpdateLeftHandRotation(const FRotator& Rotation, const bool bUpdateVirtualHand);
void UpdateRightHandRotation(const FRotator& Rotation, const bool bUpdateVirtualHand);
void UpdateHandLocationAndRotation(
const bool bRight, const FVector& Location, const FRotator& Rotation, const bool bUpdateVirtualHand);
void UpdateLeftHandLocationAndRotation(
const FVector& Location, const FRotator& Rotation, const bool bUpdateVirtualHand);
void UpdateRightHandLocationAndRotation(
const FVector& Location, const FRotator& Rotation, const bool bUpdateVirtualHand);
FORCEINLINE void RegisterLeftHandOverlappedActor(const AActor* Actor) const
{
Owner->LeftHandOverlappedActors.AddUnique(Actor);
}
FORCEINLINE void UnregisterLeftHandOverlappedActor(const AActor* Actor) const
{
Owner->LeftHandOverlappedActors.Remove(Actor);
}
FORCEINLINE void RegisterRightHandOverlappedActor(const AActor* Actor) const
{
Owner->RightHandOverlappedActors.AddUnique(Actor);
}
FORCEINLINE void UnregisterRightHandOverlappedActor(const AActor* Actor) const
{
Owner->RightHandOverlappedActors.Remove(Actor);
}
FORCEINLINE bool IsLeftHandOverlappingWithAnyActor() const
{
return Owner->LeftHandOverlappedActors.Num() > 0;
}
FORCEINLINE bool IsRightHandOverlappingWithAnyActor() const
{
return Owner->RightHandOverlappedActors.Num() > 0;
}
void DisableActorPhysics(const AActor* Actor) const;
void EnableActorPhysics(const AActor* Actor) const;
void ApplyHandVelocityToGrabbedActor(const FSGGrabState& GrabState) const;
void SetGrabbedActor(FSGGrabState& GrabState, AActor* Actor) const;
void SetLeftHandGrabbedActor(AActor* Actor) const;
void SetRightHandGrabbedActor(AActor* Actor) const;
void RecordHandVelocity(FSGGrabState& GrabState, const float DeltaSeconds) const;
void Release(FSGGrabState& GrabState) const;
};
ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
@@ -105,6 +167,19 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
HandLeft = ObjectInitializer.CreateDefaultSubobject<USGVirtualHandComponent>(this, TEXT("HandLeft"));
HandLeft->SetupAttachment(GetRootComponent());
HandLeft->SetCanEverAffectNavigation(false);
HandLeft->SetGenerateOverlapEvents(true);
HandLeft->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
HandLeft->SetCollisionObjectType(ECC_Pawn);
HandLeft->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
HandLeft->SetCollisionResponseToAllChannels(ECR_Block);
HandLeft->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Block);
HandLeft->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Block);
HandLeft->SetCollisionResponseToChannel(ECC_Pawn, ECR_Block);
HandLeft->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
HandLeft->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Block);
HandLeft->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Block);
HandLeft->SetCollisionResponseToChannel(ECC_Destructible, ECR_Block);
HandLeft->SetRight(false);
HandLeft->SetHiddenIfNoGloveDetected(true);
HandLeft->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
@@ -113,6 +188,36 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
false, nullptr, ETeleportType::None);
HandLeft->SetWristTracker(WristTrackerLeft);
RealHandLeft = ObjectInitializer.CreateDefaultSubobject<USGVirtualHandComponent>(this, TEXT("RealHandLeft"));
RealHandLeft->SetupAttachment(GetRootComponent());
RealHandLeft->SetCanEverAffectNavigation(false);
RealHandLeft->SetGenerateOverlapEvents(true);
RealHandLeft->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RealHandLeft->SetCollisionObjectType(ECC_Pawn);
RealHandLeft->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RealHandLeft->SetCollisionResponseToAllChannels(ECR_Overlap);
RealHandLeft->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
RealHandLeft->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap);
RealHandLeft->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
RealHandLeft->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap);
RealHandLeft->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap);
RealHandLeft->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap);
RealHandLeft->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap);
RealHandLeft->SetRight(false);
Pimpl->SetVisibility(RealHandLeft, false);
RealHandLeft->SetHiddenIfNoGloveDetected(true);
RealHandLeft->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
false, nullptr, ETeleportType::None);
RealHandLeft->SetRelativeLocation(FVector{30.0f, -20.0f, -10.0f},
false, nullptr, ETeleportType::None);
RealHandLeft->SetWristTracker(WristTrackerLeft);
FSGDebugVirtualHandSettings RealHandLeftDebugSettings;
RealHandLeftDebugSettings.bDrawDebugVirtualHand = true;
RealHandLeftDebugSettings.DrawingMode = ESGDebugVirtualHandDrawingMode::GizmoJoints;
RealHandLeftDebugSettings.GizmoThickness = 0.5f;
RealHandLeft->SetDebugVirtualHandSettings(MoveTemp(RealHandLeftDebugSettings));
LeftThumbFingertipGrabCollider = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(
this, TEXT("LeftThumbFingertipGrabCollider"));
LeftThumbFingertipGrabCollider->SetRelativeScale3D(HandLeft->GetDefaultFingertipsGrabColliderSize());
@@ -121,7 +226,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
LeftThumbFingertipGrabCollider->bCastDynamicShadow = false;
LeftThumbFingertipGrabCollider->SetReceivesDecals(true);
LeftThumbFingertipGrabCollider->SetCanEverAffectNavigation(false);
LeftThumbFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic);
LeftThumbFingertipGrabCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
LeftThumbFingertipGrabCollider->SetCollisionObjectType(ECC_Pawn);
LeftThumbFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
LeftThumbFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
LeftThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -140,7 +246,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
LeftIndexFingertipGrabCollider->bCastDynamicShadow = false;
LeftIndexFingertipGrabCollider->SetReceivesDecals(true);
LeftIndexFingertipGrabCollider->SetCanEverAffectNavigation(false);
LeftIndexFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic);
LeftIndexFingertipGrabCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
LeftIndexFingertipGrabCollider->SetCollisionObjectType(ECC_Pawn);
LeftIndexFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
LeftIndexFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
LeftIndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -159,7 +266,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
LeftMiddleFingertipGrabCollider->bCastDynamicShadow = false;
LeftMiddleFingertipGrabCollider->SetReceivesDecals(true);
LeftMiddleFingertipGrabCollider->SetCanEverAffectNavigation(false);
LeftMiddleFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic);
LeftMiddleFingertipGrabCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
LeftMiddleFingertipGrabCollider->SetCollisionObjectType(ECC_Pawn);
LeftMiddleFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
LeftMiddleFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
LeftMiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -178,7 +286,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
LeftThumbFingertipTouchCollider->bCastDynamicShadow = false;
LeftThumbFingertipTouchCollider->SetReceivesDecals(true);
LeftThumbFingertipTouchCollider->SetCanEverAffectNavigation(false);
LeftThumbFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
LeftThumbFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
LeftThumbFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
LeftThumbFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
LeftThumbFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
LeftThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -197,7 +306,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
LeftIndexFingertipTouchCollider->bCastDynamicShadow = false;
LeftIndexFingertipTouchCollider->SetReceivesDecals(true);
LeftIndexFingertipTouchCollider->SetCanEverAffectNavigation(false);
LeftIndexFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
LeftIndexFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
LeftIndexFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
LeftIndexFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
LeftIndexFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
LeftIndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -216,7 +326,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
LeftMiddleFingertipTouchCollider->bCastDynamicShadow = false;
LeftMiddleFingertipTouchCollider->SetReceivesDecals(true);
LeftMiddleFingertipTouchCollider->SetCanEverAffectNavigation(false);
LeftMiddleFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
LeftMiddleFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
LeftMiddleFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
LeftMiddleFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
LeftMiddleFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
LeftMiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -235,7 +346,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
LeftRingFingertipTouchCollider->bCastDynamicShadow = false;
LeftRingFingertipTouchCollider->SetReceivesDecals(true);
LeftRingFingertipTouchCollider->SetCanEverAffectNavigation(false);
LeftRingFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
LeftRingFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
LeftRingFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
LeftRingFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
LeftRingFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
LeftRingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -254,7 +366,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
LeftPinkyFingertipTouchCollider->bCastDynamicShadow = false;
LeftPinkyFingertipTouchCollider->SetReceivesDecals(true);
LeftPinkyFingertipTouchCollider->SetCanEverAffectNavigation(false);
LeftPinkyFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
LeftPinkyFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
LeftPinkyFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
LeftPinkyFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
LeftPinkyFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
LeftPinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -272,7 +385,21 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
HandRight = ObjectInitializer.CreateDefaultSubobject<USGVirtualHandComponent>(this, TEXT("HandRight"));
HandRight->SetupAttachment(GetRootComponent());
HandRight->SetCanEverAffectNavigation(false);
HandRight->SetGenerateOverlapEvents(true);
HandRight->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
HandRight->SetCollisionObjectType(ECC_Pawn);
HandRight->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
HandRight->SetCollisionResponseToAllChannels(ECR_Block);
HandRight->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Block);
HandRight->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Block);
HandRight->SetCollisionResponseToChannel(ECC_Pawn, ECR_Block);
HandRight->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
HandRight->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Block);
HandRight->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Block);
HandRight->SetCollisionResponseToChannel(ECC_Destructible, ECR_Block);
HandRight->SetRight(true);
HandRight->SetHiddenInGame(true);
HandRight->SetHiddenIfNoGloveDetected(true);
HandRight->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
false, nullptr, ETeleportType::None);
@@ -280,6 +407,36 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
false, nullptr, ETeleportType::None);
HandRight->SetWristTracker(WristTrackerRight);
RealHandRight = ObjectInitializer.CreateDefaultSubobject<USGVirtualHandComponent>(this, TEXT("RealHandRight"));
RealHandRight->SetupAttachment(GetRootComponent());
RealHandRight->SetCanEverAffectNavigation(false);
RealHandRight->SetGenerateOverlapEvents(true);
RealHandRight->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RealHandRight->SetCollisionObjectType(ECC_Pawn);
RealHandRight->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RealHandRight->SetCollisionResponseToAllChannels(ECR_Overlap);
RealHandRight->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
RealHandRight->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap);
RealHandRight->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
RealHandRight->SetCollisionResponseToChannel(ECC_Visibility, ECR_Overlap);
RealHandRight->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap);
RealHandRight->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap);
RealHandRight->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap);
RealHandRight->SetRight(true);
Pimpl->SetVisibility(RealHandRight, false);
RealHandRight->SetHiddenIfNoGloveDetected(true);
RealHandRight->SetRelativeRotation(FRotator{0.0f, -90.0f, 0.0f},
false, nullptr, ETeleportType::None);
RealHandRight->SetRelativeLocation(FVector{30.0f, 20.0f, -10.0f},
false, nullptr, ETeleportType::None);
RealHandRight->SetWristTracker(WristTrackerRight);
FSGDebugVirtualHandSettings RealHandRightDebugSettings;
RealHandRightDebugSettings.bDrawDebugVirtualHand = true;
RealHandRightDebugSettings.DrawingMode = ESGDebugVirtualHandDrawingMode::GizmoJoints;
RealHandRightDebugSettings.GizmoThickness = 0.5f;
RealHandRight->SetDebugVirtualHandSettings(MoveTemp(RealHandRightDebugSettings));
RightThumbFingertipGrabCollider = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(
this, TEXT("RightThumbFingertipGrabCollider"));
RightThumbFingertipGrabCollider->SetRelativeScale3D(HandLeft->GetDefaultFingertipsGrabColliderSize());
@@ -288,7 +445,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightThumbFingertipGrabCollider->bCastDynamicShadow = false;
RightThumbFingertipGrabCollider->SetReceivesDecals(true);
RightThumbFingertipGrabCollider->SetCanEverAffectNavigation(false);
RightThumbFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic);
RightThumbFingertipGrabCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RightThumbFingertipGrabCollider->SetCollisionObjectType(ECC_Pawn);
RightThumbFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RightThumbFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
RightThumbFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -307,7 +465,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightIndexFingertipGrabCollider->bCastDynamicShadow = false;
RightIndexFingertipGrabCollider->SetReceivesDecals(true);
RightIndexFingertipGrabCollider->SetCanEverAffectNavigation(false);
RightIndexFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic);
RightIndexFingertipGrabCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RightIndexFingertipGrabCollider->SetCollisionObjectType(ECC_Pawn);
RightIndexFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RightIndexFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
RightIndexFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -326,7 +485,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightMiddleFingertipGrabCollider->bCastDynamicShadow = false;
RightMiddleFingertipGrabCollider->SetReceivesDecals(true);
RightMiddleFingertipGrabCollider->SetCanEverAffectNavigation(false);
RightMiddleFingertipGrabCollider->SetCollisionObjectType(ECC_WorldDynamic);
RightMiddleFingertipGrabCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RightMiddleFingertipGrabCollider->SetCollisionObjectType(ECC_Pawn);
RightMiddleFingertipGrabCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RightMiddleFingertipGrabCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
RightMiddleFingertipGrabCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -345,7 +505,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightThumbFingertipTouchCollider->bCastDynamicShadow = false;
RightThumbFingertipTouchCollider->SetReceivesDecals(true);
RightThumbFingertipTouchCollider->SetCanEverAffectNavigation(false);
RightThumbFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
RightThumbFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RightThumbFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
RightThumbFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RightThumbFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
RightThumbFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -364,7 +525,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightIndexFingertipTouchCollider->bCastDynamicShadow = false;
RightIndexFingertipTouchCollider->SetReceivesDecals(true);
RightIndexFingertipTouchCollider->SetCanEverAffectNavigation(false);
RightIndexFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
RightIndexFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RightIndexFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
RightIndexFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RightIndexFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
RightIndexFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -383,7 +545,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightMiddleFingertipTouchCollider->bCastDynamicShadow = false;
RightMiddleFingertipTouchCollider->SetReceivesDecals(true);
RightMiddleFingertipTouchCollider->SetCanEverAffectNavigation(false);
RightMiddleFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
RightMiddleFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RightMiddleFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
RightMiddleFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RightMiddleFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
RightMiddleFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -402,7 +565,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightRingFingertipTouchCollider->bCastDynamicShadow = false;
RightRingFingertipTouchCollider->SetReceivesDecals(true);
RightRingFingertipTouchCollider->SetCanEverAffectNavigation(false);
RightRingFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
RightRingFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RightRingFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
RightRingFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RightRingFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
RightRingFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -421,7 +585,8 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightPinkyFingertipTouchCollider->bCastDynamicShadow = false;
RightPinkyFingertipTouchCollider->SetReceivesDecals(true);
RightPinkyFingertipTouchCollider->SetCanEverAffectNavigation(false);
RightPinkyFingertipTouchCollider->SetCollisionObjectType(ECC_WorldDynamic);
RightPinkyFingertipTouchCollider->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_Owner;
RightPinkyFingertipTouchCollider->SetCollisionObjectType(ECC_Pawn);
RightPinkyFingertipTouchCollider->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
RightPinkyFingertipTouchCollider->SetCollisionResponseToAllChannels(ECR_Overlap);
RightPinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
@@ -432,10 +597,12 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
RightPinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Overlap);
RightPinkyFingertipTouchCollider->SetCollisionResponseToChannel(ECC_Destructible, ECR_Overlap);
LeftHandGrabState = FSGGrabState(HandLeft, nullptr, nullptr, nullptr, nullptr);
MaxNumberOfHandVelocitySamples = 10;
LeftHandGrabState = FSGGrabState(HandLeft, FVector::Zero(), {}, nullptr, nullptr, nullptr, nullptr);
LeftHandTouchState = FSGTouchState(HandLeft, nullptr, nullptr, nullptr, nullptr, nullptr);
RightHandGrabState = FSGGrabState(HandLeft, nullptr, nullptr, nullptr, nullptr);
RightHandGrabState = FSGGrabState(HandRight, FVector::Zero(), {}, nullptr, nullptr, nullptr, nullptr);
RightHandTouchState = FSGTouchState(HandRight, nullptr, nullptr, nullptr, nullptr, nullptr);
}
@@ -452,24 +619,26 @@ void ASGPawn::BeginPlay()
WristTrackerLeft->OnWristLocationChanged().AddWeakLambda(this, [&](const FVector& Location)-> void
{
HandLeft->SetWorldLocation(Location);
Pimpl->UpdateLeftHandLocation(Location, !Pimpl->IsLeftHandOverlappingWithAnyActor());
});
WristTrackerLeft->OnWristRotationChanged().AddWeakLambda(this, [&](const FRotator& Rotation)-> void
{
HandLeft->SetWorldRotation(Rotation);
Pimpl->UpdateLeftHandRotation(Rotation, !Pimpl->IsLeftHandOverlappingWithAnyActor());
});
WristTrackerRight->OnWristLocationChanged().AddWeakLambda(this, [&](const FVector& Location)-> void
{
HandRight->SetWorldLocation(Location);
Pimpl->UpdateRightHandLocation(Location, !Pimpl->IsRightHandOverlappingWithAnyActor());
});
WristTrackerRight->OnWristRotationChanged().AddWeakLambda(this, [&](const FRotator& Rotation)-> void
{
HandRight->SetWorldRotation(Rotation);
Pimpl->UpdateRightHandRotation(Rotation, !Pimpl->IsRightHandOverlappingWithAnyActor());
});
Pimpl->BindRealHandsOverlapEvents();
Pimpl->BindFingerGrabOverlapEvents();
Pimpl->BindFingerTouchOverlapEvents();
}
@@ -478,10 +647,20 @@ void ASGPawn::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
Pimpl->UnbindRealHandsOverlapEvents();
Pimpl->UnbindFingerGrabOverlapEvents();
Pimpl->UnbindFingerTouchOverlapEvents();
}
void ASGPawn::Tick(const float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
Pimpl->RecordHandVelocity(LeftHandGrabState, DeltaSeconds);
Pimpl->RecordHandVelocity(RightHandGrabState, DeltaSeconds);
}
void ASGPawn::PreInitializeComponents()
{
Super::PreInitializeComponents();
@@ -490,6 +669,101 @@ void ASGPawn::PreInitializeComponents()
WristTrackerRight->SetRight(HandRight->IsRight());
}
void ASGPawn::PostInitializeComponents()
{
Super::PostInitializeComponents();
}
void ASGPawn::OnRealLeftHandOverlapBegins(
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 (OtherActor == this)
{
return;
}
if (OtherActor == LeftHandGrabState.GrabbedActor)
{
return;
}
Pimpl->RegisterLeftHandOverlappedActor(OtherActor);
}
void ASGPawn::OnRealLeftHandOverlapEnds(
UPrimitiveComponent* OverlappedComponent,
AActor* OtherActor,
UPrimitiveComponent* OtherComp,
const int32 OtherBodyIndex)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
if (OtherActor == this)
{
return;
}
Pimpl->UnregisterLeftHandOverlappedActor(OtherActor);
}
void ASGPawn::OnRealRightHandOverlapBegins(
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 (OtherActor == this)
{
return;
}
if (OtherActor == RightHandGrabState.GrabbedActor)
{
return;
}
Pimpl->RegisterRightHandOverlappedActor(OtherActor);
}
void ASGPawn::OnRealRightHandOverlapEnds(
UPrimitiveComponent* OverlappedComponent,
AActor* OtherActor,
UPrimitiveComponent* OtherComp,
const int32 OtherBodyIndex)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
if (OtherActor == this)
{
return;
}
Pimpl->UnregisterRightHandOverlappedActor(OtherActor);
}
void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapBegins(
UPrimitiveComponent* OverlappedComponent,
AActor* OtherActor,
@@ -499,6 +773,7 @@ void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapBegins(
const FHitResult& SweepResult)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
(void) bFromSweep;
(void) SweepResult;
@@ -517,6 +792,7 @@ void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapEnds(
const int32 OtherBodyIndex)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
if (LeftHandGrabState.ActorThumbCanGrab == OtherActor)
@@ -535,6 +811,7 @@ void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapBegins(
const FHitResult& SweepResult)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
(void) bFromSweep;
(void) SweepResult;
@@ -553,6 +830,7 @@ void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapEnds(
const int32 OtherBodyIndex)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
if (LeftHandGrabState.ActorIndexCanGrab == OtherActor)
@@ -571,6 +849,7 @@ void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapBegins(
const FHitResult& SweepResult)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
(void) bFromSweep;
(void) SweepResult;
@@ -589,6 +868,7 @@ void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapEnds(
const int32 OtherBodyIndex)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
if (LeftHandGrabState.ActorMiddleCanGrab == OtherActor)
@@ -797,6 +1077,7 @@ void ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins(
const FHitResult& SweepResult)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
(void) bFromSweep;
(void) SweepResult;
@@ -815,6 +1096,7 @@ void ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds(
const int32 OtherBodyIndex)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
if (RightHandGrabState.ActorThumbCanGrab == OtherActor)
@@ -833,6 +1115,7 @@ void ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins(
const FHitResult& SweepResult)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
(void) bFromSweep;
(void) SweepResult;
@@ -851,6 +1134,7 @@ void ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds(
const int32 OtherBodyIndex)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
if (RightHandGrabState.ActorThumbCanGrab == OtherActor)
@@ -869,6 +1153,7 @@ void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins(
const FHitResult& SweepResult)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
(void) bFromSweep;
(void) SweepResult;
@@ -887,6 +1172,7 @@ void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds(
const int32 OtherBodyIndex)
{
(void) OverlappedComponent;
(void) OtherComp;
(void) OtherBodyIndex;
if (RightHandGrabState.ActorMiddleCanGrab == OtherActor)
@@ -1141,76 +1427,60 @@ void ASGPawn::Grab(USGVirtualHandComponent* Hand, AActor* Actor)
Pimpl->DisableActorPhysics(Actor);
}
if (Hand->IsRight())
{
Pimpl->UnregisterRightHandOverlappedActor(Actor);
}
else
{
Pimpl->UnregisterLeftHandOverlappedActor(Actor);
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
const bool bAttached = Actor->AttachToComponent(Hand, MoveTemp(AttachmentRules), SocketName);
if (bAttached)
{
LeftHandGrabState.GrabbedActor = Actor;
if (Hand->IsRight())
{
Pimpl->SetRightHandGrabbedActor(Actor);
}
else
{
Pimpl->SetLeftHandGrabbedActor(Actor);
}
}
else
{
SGLOG_ERROR("Failed to grab the actor with the left hand!", Actor, SocketName);
if (Hand->IsRight())
{
SGLOG_ERROR("Failed to grab the actor with the right hand!", Actor, SocketName);
}
else
{
SGLOG_ERROR("Failed to grab the actor with the left hand!", Actor, SocketName);
}
}
#else
Actor->AttachToComponent(Hand, MoveTemp(AttachmentRules), SocketName);
LeftHandGrabState.GrabbedActor = Actor;
if (Hand->IsRight())
{
Pimpl->SetRightHandGrabbedActor(Actor);
}
else
{
Pimpl->SetLeftHandGrabbedActor(Actor);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
}
void ASGPawn::ReleaseLeft()
{
if (!IsValid(LeftHandGrabState.GrabbedActor))
{
return;
}
const USGGrabComponent* GrabComponent{USGGrabComponent::GetGrabComponent(LeftHandGrabState.GrabbedActor)};
if (!IsValid(GrabComponent))
{
return;
}
LeftHandGrabState.GrabbedActor->DetachFromActor(
FDetachmentTransformRules(GrabComponent->GetDetachmentLocationRule(),
GrabComponent->GetDetachmentRotationRule(),
GrabComponent->GetDetachmentScaleRule(),
GrabComponent->GetDetachmentInCallModify())
);
if (GrabComponent->GetAffectPhysicsState())
{
Pimpl->EnableActorPhysics(LeftHandGrabState.GrabbedActor);
}
LeftHandGrabState.GrabbedActor = nullptr;
Pimpl->Release(LeftHandGrabState);
}
void ASGPawn::ReleaseRight()
{
if (!IsValid(RightHandGrabState.GrabbedActor))
{
return;
}
const USGGrabComponent* GrabComponent{USGGrabComponent::GetGrabComponent(RightHandGrabState.GrabbedActor)};
if (!IsValid(GrabComponent))
{
return;
}
RightHandGrabState.GrabbedActor->DetachFromActor(
FDetachmentTransformRules(GrabComponent->GetDetachmentLocationRule(),
GrabComponent->GetDetachmentRotationRule(),
GrabComponent->GetDetachmentScaleRule(),
GrabComponent->GetDetachmentInCallModify())
);
if (GrabComponent->GetAffectPhysicsState())
{
Pimpl->EnableActorPhysics(RightHandGrabState.GrabbedActor);
}
RightHandGrabState.GrabbedActor = nullptr;
Pimpl->Release(RightHandGrabState);
}
ASGPawn::FImpl::FImpl(ASGPawn* InOwner)
@@ -1218,6 +1488,32 @@ ASGPawn::FImpl::FImpl(ASGPawn* InOwner)
{
}
void ASGPawn::FImpl::BindRealHandsOverlapEvents()
{
Owner->RealHandLeft->OnComponentBeginOverlap.AddDynamic(
Owner, &ASGPawn::OnRealLeftHandOverlapBegins);
Owner->RealHandLeft->OnComponentEndOverlap.AddDynamic(
Owner, &ASGPawn::OnRealLeftHandOverlapEnds);
Owner->RealHandRight->OnComponentBeginOverlap.AddDynamic(
Owner, &ASGPawn::OnRealRightHandOverlapBegins);
Owner->RealHandRight->OnComponentEndOverlap.AddDynamic(
Owner, &ASGPawn::OnRealRightHandOverlapEnds);
}
void ASGPawn::FImpl::UnbindRealHandsOverlapEvents()
{
Owner->RealHandLeft->OnComponentBeginOverlap.RemoveDynamic(
Owner, &ASGPawn::OnRealLeftHandOverlapBegins);
Owner->RealHandLeft->OnComponentEndOverlap.RemoveDynamic(
Owner, &ASGPawn::OnRealLeftHandOverlapEnds);
Owner->RealHandRight->OnComponentBeginOverlap.RemoveDynamic(
Owner, &ASGPawn::OnRealRightHandOverlapBegins);
Owner->RealHandRight->OnComponentEndOverlap.RemoveDynamic(
Owner, &ASGPawn::OnRealRightHandOverlapEnds);
}
void ASGPawn::FImpl::BindFingerGrabOverlapEvents()
{
Owner->LeftThumbFingertipGrabCollider->OnComponentBeginOverlap.AddDynamic(
@@ -1405,10 +1701,107 @@ void ASGPawn::FImpl::UnbindFingerTouchOverlapEvents()
Owner, &ASGPawn::OnRightPinkyFingertipTouchColliderOverlapEnds);
}
void ASGPawn::FImpl::SetVisibility(USceneComponent* SceneComponent, const bool bVisibility) const
{
if (!ensureAlwaysMsgf(IsValid(SceneComponent), TEXT("Invalid SceneComponent!")))
{
return;
}
SceneComponent->SetHiddenInGame(!bVisibility);
SceneComponent->SetVisibility(bVisibility);
}
void ASGPawn::FImpl::UpdateHandLocation(const bool bRight, const FVector& Location, const bool bUpdateVirtualHand)
{
if (bRight)
{
UpdateRightHandLocation(Location, bUpdateVirtualHand);
}
else
{
UpdateLeftHandLocation(Location, bUpdateVirtualHand);
}
}
void ASGPawn::FImpl::UpdateLeftHandLocation(const FVector& Location, const bool bUpdateVirtualHand)
{
if (bUpdateVirtualHand)
{
Owner->HandLeft->SetWorldLocation(Location);
}
Owner->RealHandLeft->SetWorldLocation(Location);
}
void ASGPawn::FImpl::UpdateRightHandLocation(const FVector& Location, const bool bUpdateVirtualHand)
{
if (bUpdateVirtualHand)
{
Owner->HandRight->SetWorldLocation(Location);
}
Owner->RealHandRight->SetWorldLocation(Location);
}
void ASGPawn::FImpl::UpdateHandRotation(const bool bRight, const FRotator& Rotation, const bool bUpdateVirtualHand)
{
if (bRight)
{
UpdateRightHandRotation(Rotation, bUpdateVirtualHand);
}
else
{
UpdateLeftHandRotation(Rotation, bUpdateVirtualHand);
}
}
void ASGPawn::FImpl::UpdateLeftHandRotation(const FRotator& Rotation, const bool bUpdateVirtualHand)
{
if (bUpdateVirtualHand)
{
Owner->HandLeft->SetWorldRotation(Rotation);
}
Owner->RealHandLeft->SetWorldRotation(Rotation);
}
void ASGPawn::FImpl::UpdateRightHandRotation(const FRotator& Rotation, const bool bUpdateVirtualHand)
{
if (bUpdateVirtualHand)
{
Owner->HandRight->SetWorldRotation(Rotation);
}
Owner->RealHandRight->SetWorldRotation(Rotation);
}
void ASGPawn::FImpl::UpdateHandLocationAndRotation(
const bool bRight, const FVector& Location, const FRotator& Rotation, const bool bUpdateVirtualHand)
{
if (bRight)
{
UpdateRightHandLocationAndRotation(Location, Rotation, bUpdateVirtualHand);
}
else
{
UpdateLeftHandLocationAndRotation(Location, Rotation, bUpdateVirtualHand);
}
}
void ASGPawn::FImpl::UpdateLeftHandLocationAndRotation(
const FVector& Location, const FRotator& Rotation, const bool bUpdateVirtualHand)
{
UpdateLeftHandLocation(Location, bUpdateVirtualHand);
UpdateLeftHandRotation(Rotation, bUpdateVirtualHand);
}
void ASGPawn::FImpl::UpdateRightHandLocationAndRotation(
const FVector& Location, const FRotator& Rotation, const bool bUpdateVirtualHand)
{
UpdateRightHandLocation(Location, bUpdateVirtualHand);
UpdateRightHandRotation(Rotation, bUpdateVirtualHand);
}
void ASGPawn::FImpl::DisableActorPhysics(const AActor* Actor) const
{
UPrimitiveComponent* ActorRootComponent{Cast<UPrimitiveComponent>(Actor->GetRootComponent())};
if (!ensureAlwaysMsgf(IsValid(ActorRootComponent), TEXT("RootComponent is not a valid UPrimativeComponent!")))
{
return;
@@ -1416,6 +1809,7 @@ void ASGPawn::FImpl::DisableActorPhysics(const AActor* Actor) const
ActorRootComponent->SetEnableGravity(false);
ActorRootComponent->SetSimulatePhysics(false);
ActorRootComponent->PutRigidBodyToSleep();
}
void ASGPawn::FImpl::EnableActorPhysics(const AActor* Actor) const
@@ -1426,7 +1820,6 @@ void ASGPawn::FImpl::EnableActorPhysics(const AActor* Actor) const
}
UPrimitiveComponent* ActorRootComponent{Cast<UPrimitiveComponent>(Actor->GetRootComponent())};
if (!ensureAlwaysMsgf(IsValid(ActorRootComponent), TEXT("RootComponent is not a valid UPrimativeComponent!")))
{
return;
@@ -1434,6 +1827,103 @@ void ASGPawn::FImpl::EnableActorPhysics(const AActor* Actor) const
ActorRootComponent->SetEnableGravity(true);
ActorRootComponent->SetSimulatePhysics(true);
ActorRootComponent->WakeRigidBody();
}
void ASGPawn::FImpl::ApplyHandVelocityToGrabbedActor(const FSGGrabState& GrabState) const
{
if (!IsValid(GrabState.Hand))
{
return;
}
if (!IsValid(GrabState.GrabbedActor))
{
return;
}
UPrimitiveComponent* ActorRootComponent{Cast<UPrimitiveComponent>(GrabState.GrabbedActor->GetRootComponent())};
if (!ensureAlwaysMsgf(IsValid(ActorRootComponent), TEXT("RootComponent is not a valid UPrimativeComponent!")))
{
return;
}
FVector HandVelocity{UKismetMathLibrary::GetVectorArrayAverage(GrabState.HandVelocityHistory)};
ActorRootComponent->SetPhysicsLinearVelocity(HandVelocity);
ActorRootComponent->AddImpulse(MoveTemp(HandVelocity), NAME_None, true);
}
void ASGPawn::FImpl::SetGrabbedActor(FSGGrabState& GrabState, AActor* Actor) const
{
GrabState.GrabbedActor = Actor;
}
void ASGPawn::FImpl::SetLeftHandGrabbedActor(AActor* Actor) const
{
SetGrabbedActor(Owner->LeftHandGrabState, Actor);
}
void ASGPawn::FImpl::SetRightHandGrabbedActor(AActor* Actor) const
{
SetGrabbedActor(Owner->RightHandGrabState, Actor);
}
void ASGPawn::FImpl::RecordHandVelocity(FSGGrabState& GrabState, const float DeltaSeconds) const
{
if (!IsValid(GrabState.Hand))
{
return;
}
FVector HandVelocity{
(GrabState.Hand->GetComponentLocation() - GrabState.PreviousHandLocation) / DeltaSeconds
};
if (GrabState.HandVelocityHistory.Num() >= Owner->MaxNumberOfHandVelocitySamples)
{
if (GrabState.HandVelocityHistory.IsValidIndex(0))
{
GrabState.HandVelocityHistory.RemoveAt(0, 1, false);
GrabState.HandVelocityHistory.Emplace(MoveTemp(HandVelocity));
}
}
else
{
GrabState.HandVelocityHistory.Emplace(MoveTemp(HandVelocity));
}
GrabState.PreviousHandLocation = GrabState.Hand->GetComponentLocation();
}
void ASGPawn::FImpl::Release(FSGGrabState& GrabState) const
{
if (!IsValid(GrabState.GrabbedActor))
{
return;
}
const USGGrabComponent* GrabComponent{USGGrabComponent::GetGrabComponent(GrabState.GrabbedActor)};
if (!IsValid(GrabComponent))
{
return;
}
GrabState.GrabbedActor->DetachFromActor(
FDetachmentTransformRules(GrabComponent->GetDetachmentLocationRule(),
GrabComponent->GetDetachmentRotationRule(),
GrabComponent->GetDetachmentScaleRule(),
GrabComponent->GetDetachmentInCallModify())
);
if (GrabComponent->GetAffectPhysicsState())
{
EnableActorPhysics(GrabState.GrabbedActor);
}
ApplyHandVelocityToGrabbedActor(GrabState);
SetGrabbedActor(GrabState, nullptr);
}
ASGPawn::FImpl::~FImpl() = default;
@@ -48,6 +48,7 @@
#include "SenseGlove/GameFramework/SGPawn.h"
#include "SenseGlove/Haptics/SGGrabState.h"
#include "SenseGlove/Haptics/SGTouchState.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCore/SGBuzzCommand.h"
#include "SGCore/SGForceFeedbackCommand.h"
#include "SGCore/SGHapticGlove.h"
@@ -204,7 +205,7 @@ void ASGPlayerController::BeginPlay()
}
SGPawn->OnGrabStateUpdated().AddWeakLambda(
this, [=](const FSGGrabState& GrabState) -> void
this, [= SG_CAPTURE_THIS](const FSGGrabState& GrabState) -> void
{
if (!IsValid(SGPawn))
{
@@ -235,7 +236,7 @@ void ASGPlayerController::BeginPlay()
});
SGPawn->OnTouchStateUpdated().AddWeakLambda(
this, [=](const FSGTouchState& TouchState) -> void
this, [= SG_CAPTURE_THIS](const FSGTouchState& TouchState) -> void
{
Pimpl->UpdateHapticsFeedback(TouchState);
});
@@ -338,7 +339,7 @@ void ASGPlayerController::FImpl::UpdateHapticsFeedback(const FSGTouchState& Touc
Owner->GetWorldTimerManager().ClearTimer(TouchBuzzStopTimer);
FTimerDelegate TouchBuzzStopHandler;
TouchBuzzStopHandler.BindLambda([=]()-> void
TouchBuzzStopHandler.BindLambda([= SG_CAPTURE_THIS]()-> void
{
Glove->SendHaptics(USGBuzzCommand::Off(Owner));
});
@@ -249,7 +249,7 @@ ASGVirtualHandActor::ASGVirtualHandActor(const FObjectInitializer& ObjectInitial
WristTracker->SetRight(VirtualHand->IsRight());
GrabState = FSGGrabState(VirtualHand, nullptr, nullptr, nullptr, nullptr);
GrabState = FSGGrabState(VirtualHand, FVector::Zero(), {}, nullptr, nullptr, nullptr, nullptr);
TouchState = FSGTouchState(VirtualHand, nullptr, nullptr, nullptr, nullptr, nullptr);
}
@@ -41,6 +41,8 @@
FSGGrabState::FSGGrabState()
: Hand(nullptr),
PreviousHandLocation(FVector::Zero()),
HandVelocityHistory{},
ActorThumbCanGrab(nullptr),
ActorIndexCanGrab(nullptr),
ActorMiddleCanGrab(nullptr),
@@ -49,11 +51,15 @@ FSGGrabState::FSGGrabState()
}
FSGGrabState::FSGGrabState(USGVirtualHandComponent* InHand,
const FVector& InPreviousHandLocation,
const TArray<FVector>& InHandVelocityHistory,
AActor* InActorThumbCanGrab,
AActor* InActorIndexCanGrab,
AActor* InActorMiddleCanGrab,
AActor* InGrabbedActor)
: Hand(InHand),
PreviousHandLocation(InPreviousHandLocation),
HandVelocityHistory(InHandVelocityHistory),
ActorThumbCanGrab(InActorThumbCanGrab),
ActorIndexCanGrab(InActorIndexCanGrab),
ActorMiddleCanGrab(InActorMiddleCanGrab),
@@ -127,9 +127,6 @@ private:
FSGDebugVirtualHandSettings DebugVirtualHandSettings;
private:
UPROPERTY(Transient)
uint8 bBackendInitialized : 1;
UPROPERTY(Transient)
USGHapticGlove* Glove;
@@ -254,6 +251,21 @@ public:
PinkyFingertipTouchSocketName = SocketName;
}
FORCEINLINE const FSGDebugVirtualHandSettings& GetDebugVirtualHandSettings() const
{
return DebugVirtualHandSettings;
}
FORCEINLINE FSGDebugVirtualHandSettings& GetDebugVirtualHandSettings()
{
return DebugVirtualHandSettings;
}
FORCEINLINE void SetDebugVirtualHandSettings(const FSGDebugVirtualHandSettings& InDebugVirtualHandSettings)
{
DebugVirtualHandSettings = InDebugVirtualHandSettings;
}
FORCEINLINE bool IsHiddenInGameIfNoGloveDetected() const
{
return !!bHiddenInGameIfNoGloveDetected;
@@ -111,9 +111,6 @@ private:
FSGWristTrackingSettings WristTrackingSettings;
private:
UPROPERTY(Transient)
uint8 bBackendInitialized : 1;
UPROPERTY(Transient)
USGHapticGlove* Glove;
@@ -166,12 +163,8 @@ public:
virtual void InitializeComponent() override;
virtual void UninitializeComponent() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
virtual void TickComponent(float DeltaTime,
enum ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
@@ -0,0 +1,50 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "Engine/GameInstance.h"
#include "SGGameInstance.generated.h"
UCLASS(config=Game, Transient, BlueprintType, Blueprintable)
class SENSEGLOVE_API USGGameInstance : public UGameInstance
{
GENERATED_UCLASS_BODY()
public:
virtual void Init() override;
virtual void Shutdown() override;
};
@@ -35,6 +35,7 @@
#pragma once
#include "Containers/Array.h"
#include "GameFramework/Pawn.h"
#include "SenseGlove/Components/SGVirtualHandComponent.h"
#include "Templates/UniquePtr.h"
@@ -99,6 +100,9 @@ private:
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;
@@ -129,6 +133,9 @@ private:
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;
@@ -153,6 +160,9 @@ private:
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
USphereComponent* RightPinkyFingertipTouchCollider;
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
int32 MaxNumberOfHandVelocitySamples;
private:
UPROPERTY(Transient)
FSGGrabState LeftHandGrabState;
@@ -166,6 +176,12 @@ private:
UPROPERTY(Transient)
FSGTouchState RightHandTouchState;
UPROPERTY(Transient)
TArray<const AActor*> LeftHandOverlappedActors;
UPROPERTY(Transient)
TArray<const AActor*> RightHandOverlappedActors;
public:
FORCEINLINE UCameraComponent* GetCamera() const
{
@@ -182,6 +198,11 @@ public:
return HandLeft;
}
FORCEINLINE USGVirtualHandComponent* GetRealHandLeft() const
{
return RealHandLeft;
}
FORCEINLINE USphereComponent* GetLeftThumbFingertipGrabCollider() const
{
return LeftThumbFingertipGrabCollider;
@@ -232,6 +253,11 @@ public:
return HandRight;
}
FORCEINLINE USGVirtualHandComponent* GetRealHandRight() const
{
return RealHandRight;
}
FORCEINLINE USphereComponent* GetRightThumbFingertipGrabCollider() const
{
return RightThumbFingertipGrabCollider;
@@ -272,12 +298,56 @@ public:
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,
@@ -573,19 +643,19 @@ public:
FORCEINLINE bool CanGrab(const USGVirtualHandComponent* Hand, const AActor* Actor) const
{
return Hand == HandLeft ? CanLeftHandGrab(Actor) : CanRightHandGrab(Actor);
return Hand == HandRight ? CanRightHandGrab(Actor) : CanLeftHandGrab(Actor);
}
FORCEINLINE bool IsGrabbing(const USGVirtualHandComponent* Hand, const AActor* Actor) const
{
return Hand == HandLeft ? IsLeftHandGrabbing(Actor) : IsRightHandGrabbing(Actor);
return Hand == HandRight ? IsRightHandGrabbing(Actor) : IsLeftHandGrabbing(Actor);
}
bool IsGrabbing(const USGVirtualHandComponent* Hand, AActor*& OutActor) const;
FORCEINLINE bool IsGrabbing(const USGVirtualHandComponent* Hand) const
{
return Hand == HandLeft ? IsLeftHandGrabbing() : IsRightHandGrabbing();
return Hand == HandRight ? IsRightHandGrabbing() : IsLeftHandGrabbing();
}
public:
@@ -607,6 +677,6 @@ public:
FORCEINLINE void Release(const USGVirtualHandComponent* Hand)
{
return Hand == HandLeft ? ReleaseLeft() : ReleaseRight();
return Hand == HandRight ? ReleaseRight() : ReleaseLeft();
}
};
@@ -35,6 +35,8 @@
#pragma once
#include "Containers/Array.h"
#include "Math/Vector.h"
#include "UObject/ObjectMacros.h"
#include "SGGrabState.generated.h"
@@ -53,6 +55,12 @@ public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "SenseGlove")
USGVirtualHandComponent* Hand;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "SenseGlove")
FVector PreviousHandLocation;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "SenseGlove")
TArray<FVector> HandVelocityHistory;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "SenseGlove")
AActor* ActorThumbCanGrab;
@@ -69,6 +77,8 @@ public:
FSGGrabState();
explicit FSGGrabState(USGVirtualHandComponent* InHand,
const FVector& InPreviousHandLocation,
const TArray<FVector>& InHandVelocityHistory,
AActor* InActorThumbCanGrab,
AActor* InActorIndexCanGrab,
AActor* InActorMiddleCanGrab,
+8
View File
@@ -57,6 +57,7 @@ public class SenseGlove : ModuleRules
"Engine",
"HeadMountedDisplay",
"InputCore",
"SenseGloveBackend",
"SenseGloveConnect",
"SenseGloveCore",
"SenseGloveDebug",
@@ -65,5 +66,12 @@ public class SenseGlove : ModuleRules
"SenseGloveTypes",
}
);
PrivateIncludePathModuleNames.AddRange(
new string[]
{
"SenseGloveBuildHacks",
}
);
}
}
@@ -59,12 +59,30 @@
<log text="SenseGloveAndroid [WARN]: this architecture is not supported!"/>
</false>
</if>
<setBoolFromProperty result="bCreateAFSProject" ini="Engine" section="/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings" property="bEnablePlugin" default="true"/>
</init>
<resourceCopies>
<copyFile src="$S(PluginDir)/../ThirdParty/android/sgconnect.jar" dst="$S(BuildDir)/gradle/app/libs/sgconnect.jar" />
</resourceCopies>
<gradleCopies>
<if condition="bCreateAFSProject">
<true>
<!-- Also copy into AFSProject -->
<!--
We have a dependency in the buildGradleAdditions which
isn't in the AFSProject which is compiled for shipping
builds when AndroidFileServer (AFS) is enabled. To keep
the size of the AFS APK small it doesn't automatically
copy all the libs over.
-->
<copyFile src="$S(PluginDir)/../ThirdParty/android/sgconnect.jar" dst="$S(BuildDir)/gradle/AFSProject/app/libs/sgconnect.jar" />
</true>
</if>
</gradleCopies>
<gradleProperties>
<insert>
kapt.incremental.apt=true
@@ -73,18 +91,15 @@
<proguardAdditions>
<insert>
<!-- Disable obfuscation for SenseGlove classes -->
-dontwarn com.senseglove.**
-keep class com.senseglove.** { *; }
-keep interface com.senseglove.** { *; }
-keep public class com.senseglove.sgconnect.** { public protected *; }
</insert>
</proguardAdditions>
<androidManifestUpdates>
<!-- For target SDK 31 update the SplashActivity activity -->
<loopElements tag="activity">
<setStringFromAttribute result="activityName" tag="$" name="android:name"/>
@@ -100,7 +115,6 @@
<addPermission android:name="android.permission.BLUETOOTH_ADMIN"/>
<addPermission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<addPermission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</androidManifestUpdates>
<buildGradleAdditions>
@@ -123,7 +137,6 @@
dependencies {
implementation files('libs/sgconnect.jar')
}
</insert>
</buildGradleAdditions>
@@ -0,0 +1,223 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "SGBackend/SGBackend.h"
#include "Engine/Engine.h"
#include "SGConnect/SGConnect.h"
#include "SGCore/SGDeviceList.h"
#include "SGCore/SGHapticGloveHandProfiles.h"
#include "SGLog/SGLog.h"
struct USGBackend::FImpl
{
/************************
* Owner object
************************/
USGBackend* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGBackend* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
};
USGBackend* USGBackend::GetInstance()
{
if (!ensureAlwaysMsgf(GEngine, TEXT("The engine has not been initialized!")))
{
return nullptr;
}
USGBackend* Instance{GEngine->GetEngineSubsystem<USGBackend>()};
return Instance;
}
USGBackend::USGBackend()
: Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
bBackendInitialized = false;
}
bool USGBackend::InitializeBackend()
{
if (!IsBackendInitialized())
{
#if PLATFORM_ANDROID
const int32_t Result = FSGConnect::Init();
switch (Result)
{
case -3:
SGLOG_ERROR("An Unexpected error occurred. Please try again.");
return false;
case -2:
SGLOG_ERROR("Device Scanning is already running within a different program.");
return false;
case -1:
SGLOG_ERROR("Device Scanning already being initialized (function called twice in short succession).");
return false;
case 0:
SGLOG_ERROR("Device Scanning is already running within this program.");
return false;
case 1:
SGLOG("Successfully started up DeviceScanning from the current program.");
break;
default:
ensureAlwaysMsgf(false, TEXT("Unhandled Init return status code!"));
return false;
}
#endif /* PLATFORM_ANDROID */
// Ensure that the device list is empty before doing anything.
FSGDeviceList::Dispose();
FSGDeviceList::Reinitialize();
// Load the latest hand profiles.
FSGHapticGloveHandProfiles::TryLoadingFromDisk();
bBackendInitialized = true;
return true;
}
return false;
}
bool USGBackend::UninitializeBackend()
{
if (IsBackendInitialized())
{
FSGDeviceList::Dispose();
#if PLATFORM_ANDROID
const int32_t Result = FSGConnect::Dispose();
switch (Result)
{
case -3:
SGLOG_ERROR("An Unexpected error occurred. Please try again.");
return false;
case -2:
SGLOG_ERROR("Not allowed to dispose of Device Scanning because this is not the program which started it.");
return false;
case -1:
SGLOG_ERROR("Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession).");
return false;
case 0:
SGLOG_ERROR("There is no deviceScanner running from any program, so disposing is skipped.");
return false;
case 1:
SGLOG("Successfully disposed of DeviceScanner resources.");
break;
default:
ensureAlwaysMsgf(false, TEXT("Unhandled Dispose return status code!"));
return false;
}
#endif /* PLATFORM_ANDROID */
bBackendInitialized = false;
return true;
}
return false;
}
bool USGBackend::ShouldCreateSubsystem(UObject* Outer) const
{
return true;
}
void USGBackend::Initialize(FSubsystemCollectionBase& Collection)
{
SGLOG("Initializing the SenseGlove Backend singleton with the engine lifetime...");
Super::Initialize(Collection);
SGLOG("Initializing the SenseGlove Backend singleton with the engine lifetime...");
if (InitializeBackend())
{
SGLOG("The bridge to the SenseGlove Backend has been initialized successfully!")
}
else
{
SGLOG_ERROR("Failed to initialize the bridge to the SenseGlove Backend!")
}
SGLOG("The SenseGlove Backend singleton has been successfully initialized with the engine lifetime!");
}
void USGBackend::Deinitialize()
{
SGLOG("De-initializing the SenseGlove Backend singleton due to the engine lifetime expiration...");
Super::Deinitialize();
if (UninitializeBackend())
{
SGLOG("The bridge to the SenseGlove Backend has been uninitialized successfully!")
}
else
{
SGLOG_ERROR("Failed to uninitialize the bridge to the SenseGlove Backend!")
}
(void)Pimpl.Release();
SGLOG("The SenseGlove Backend singleton has been successfully de-initialized!");
}
USGBackend::FImpl::FImpl(USGBackend* InOwner)
: Owner(InOwner)
{
}
USGBackend::FImpl::~FImpl() = default;
void USGBackend::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -0,0 +1,40 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "SenseGloveBackend.h"
#include "Modules/ModuleManager.h"
#include "SenseGloveBackendModule.h"
IMPLEMENT_MODULE(FSenseGloveBackendModule, SenseGloveBackend)
@@ -0,0 +1,38 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "CoreMinimal.h"
@@ -0,0 +1,63 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "SenseGloveBackendModule.h"
#include "SGLog/SGLog.h"
#include "SGBackend/SGBackend.h"
#define LOCTEXT_NAMESPACE "FSenseGloveBackendModule"
void FSenseGloveBackendModule::StartupModule()
{
SGLOG("Starting up SenseGloveBackend module...");
}
void FSenseGloveBackendModule::PreUnloadCallback()
{
SGLOG("Unloading SenseGloveBackend module...");
}
void FSenseGloveBackendModule::PostLoadCallback()
{
SGLOG("Loading of SenseGloveBackend module has succeeded!");
}
void FSenseGloveBackendModule::ShutdownModule()
{
SGLOG("Shutting down SenseGloveBackend module...");
}
#undef LOCTEXT_NAMESPACE
@@ -0,0 +1,51 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "Modules/ModuleInterface.h"
#define LOCTEXT_NAMESPACE "SenseGloveBackend"
class FSenseGloveBackendModule : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void PreUnloadCallback() override;
virtual void PostLoadCallback() override;
virtual void ShutdownModule() override;
};
#undef LOCTEXT_NAMESPACE
@@ -0,0 +1,87 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "Math/Color.h"
#include "Math/Rotator.h"
#include "Math/Vector.h"
#include "Subsystems/EngineSubsystem.h"
#include "Templates/UniquePtr.h"
#include "UObject/ObjectMacros.h"
#include "SGBackend.generated.h"
UCLASS(config = SenseGloveBackend)
class SENSEGLOVEBACKEND_API USGBackend : public UEngineSubsystem
{
GENERATED_BODY()
private:
UPROPERTY(Transient)
uint8 bBackendInitialized : 1;
public:
static USGBackend* GetInstance();
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
USGBackend();
public:
FORCEINLINE bool IsBackendInitialized() const
{
return !!bBackendInitialized;
}
bool InitializeBackend();
bool UninitializeBackend();
public:
virtual bool ShouldCreateSubsystem(UObject* Outer) const override;
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
virtual void Deinitialize() override;
};
@@ -0,0 +1,65 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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
*
*
*/
using System;
using UnrealBuildTool;
public class SenseGloveBackend : ModuleRules
{
public SenseGloveBackend(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"InputCore",
"SenseGloveConnect",
"SenseGloveCore",
"SenseGloveLog",
"SenseGloveTypes",
}
);
}
}
@@ -0,0 +1,58 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "SGBackendKismet/SGBackendKismetLibrary.h"
#include "SGBackend/SGBackend.h"
USGBackend* USGBackendKismetLibrary::GetInstance()
{
return USGBackend::GetInstance();
}
bool USGBackendKismetLibrary::IsBackendInitialized(const USGBackend* Backend)
{
return Backend->IsBackendInitialized();
}
bool USGBackendKismetLibrary::InitializeBackend(USGBackend* Backend)
{
return Backend->InitializeBackend();
}
bool USGBackendKismetLibrary::UninitializeBackend(USGBackend* Backend)
{
return Backend->UninitializeBackend();
}
@@ -0,0 +1,40 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "SenseGloveBackendKismet.h"
#include "Modules/ModuleManager.h"
#include "SenseGloveBackendKismetModule.h"
IMPLEMENT_MODULE(FSenseGloveBackendKismetModule, SenseGloveBackendKismet)
@@ -0,0 +1,38 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "CoreMinimal.h"
@@ -0,0 +1,62 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "SenseGloveBackendKismetModule.h"
#include "SGLog/SGLog.h"
#define LOCTEXT_NAMESPACE "FSenseGloveBackendKismetModule"
void FSenseGloveBackendKismetModule::StartupModule()
{
SGLOG("Starting up SenseGloveBackendKismet module...");
}
void FSenseGloveBackendKismetModule::PreUnloadCallback()
{
SGLOG("Unloading SenseGloveBackendKismet module...");
}
void FSenseGloveBackendKismetModule::PostLoadCallback()
{
SGLOG("Loading of SenseGloveBackendKismet module has succeeded!");
}
void FSenseGloveBackendKismetModule::ShutdownModule()
{
SGLOG("Shutting down SenseGloveBackendKismet module...");
}
#undef LOCTEXT_NAMESPACE
@@ -0,0 +1,51 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "Modules/ModuleInterface.h"
#define LOCTEXT_NAMESPACE "SenseGloveBackendKismet"
class FSenseGloveBackendKismetModule : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void PreUnloadCallback() override;
virtual void PostLoadCallback() override;
virtual void ShutdownModule() override;
};
#undef LOCTEXT_NAMESPACE
@@ -0,0 +1,61 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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 "SGBackendKismetLibrary.generated.h"
class USGBackend;
UCLASS(meta=(ScriptName = "SesneGloveBackendKismetLibrary"))
class SENSEGLOVEBACKENDKISMET_API USGBackendKismetLibrary final : public USGBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="SenseGlove | Backend")
static USGBackend* GetInstance();
UFUNCTION(BlueprintPure, Category="SenseGlove | Backend")
static bool IsBackendInitialized(const USGBackend* Backend);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Backend")
bool InitializeBackend(UPARAM(ref) USGBackend* Backend);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Backend")
bool UninitializeBackend(UPARAM(ref) USGBackend* Backend);
};
@@ -0,0 +1,64 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2023 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
*
*
*/
using System;
using UnrealBuildTool;
public class SenseGloveBackendKismet : ModuleRules
{
public SenseGloveBackendKismet(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"SenseGloveBackend",
"SenseGloveLog",
"SenseGloveKismet",
"SenseGloveTypes",
}
);
}
}
@@ -33,4 +33,4 @@
*/
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
@@ -41,8 +41,20 @@
#define SG_CPP17 0
#endif /* ( ( defined( _MSVC_LANG ) && _MSVC_LANG >= 201703L ) || __cplusplus >= 201703L ) */
#if SG_CPP17
#if ( ( defined( _MSVC_LANG ) && _MSVC_LANG >= 202002L ) || __cplusplus >= 202002L )
#define SG_CPP20 1
#else /* ( ( defined( _MSVC_LANG ) && _MSVC_LANG >= 202002L ) || __cplusplus >= 202002L ) */
#define SG_CPP20 0
#endif /* ( ( defined( _MSVC_LANG ) && _MSVC_LANG >= 202002L ) || __cplusplus >= 202002L ) */
#if SG_CPP17 || SG_CPP20
#define SG_NOEXCEPT noexcept
#else /* SG_CPP17 */
#else /* SG_CPP17 || SG_CPP20 */
#define SG_NOEXCEPT
#endif /* SG_CPP17 */
#endif /* SG_CPP17 || SG_CPP20 */
#if SG_CPP20
#define SG_CAPTURE_THIS , this
#else /* SG_CPP17 || SG_CPP20 */
#define SG_CAPTURE_THIS
#endif /* SG_CPP17 || SG_CPP20 */
@@ -147,7 +147,9 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
#if UE_5_2_OR_LATER
#if UE_5_3_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
#elif UE_5_2_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
#elif UE_5_0_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v20"));
@@ -166,7 +168,9 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
#if UE_5_2_OR_LATER
#if UE_5_3_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
#elif UE_5_2_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
#elif UE_5_0_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v20"));
@@ -292,7 +296,9 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
#if UE_5_2_OR_LATER
#if UE_5_3_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
#elif UE_5_2_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
#elif UE_5_0_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v20"));
@@ -311,7 +317,9 @@ public class SenseGloveConnectImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
#if UE_5_2_OR_LATER
#if UE_5_3_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
#elif UE_5_2_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
#elif UE_5_0_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v20"));
@@ -63,9 +63,10 @@ public class SenseGloveCore : ModuleRules
}
);
PublicIncludePathModuleNames.AddRange(
PrivateIncludePathModuleNames.AddRange(
new string[]
{
"SenseGloveBuildHacks",
"SenseGloveTypes",
}
);
@@ -42,6 +42,7 @@
#include "Runtime/Launch/Resources/Version.h"
#include "SGBuildHacks/SGInclude_Core_BasicHandModel.h"
#include "SGBuildHacks/SGInclude_Core_Quat.h"
#include "SGBuildHacks/SGInclude_Core_Vect3D.h"
#include "SGCoreImpl/SGCoreEnumCast.h"
#include "SGCoreImpl/SGQuatImpl.h"
@@ -43,6 +43,7 @@
#include "SGBuildHacks/SGInclude_Core_Quat.h"
#include "SGBuildHacks/SGInclude_Core_HandInterpolator.h"
#include "SGBuildHacks/SGInclude_Core_InterpolationSet.h"
#include "SGBuildHacks/SGInclude_Core_Vect3D.h"
#include "SGCoreImpl/SGCoreEnumCast.h"
#include "SGCoreImpl/SGInterpolationSetImpl.h"
@@ -40,7 +40,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
class FSGVect3DImpl;
@@ -39,7 +39,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -40,7 +40,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -43,8 +43,8 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCoreImpl/SGDeviceImpl.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -39,8 +39,8 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCoreImpl/SGFingerCommandImpl.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -38,7 +38,7 @@
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -41,7 +41,7 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -38,7 +38,7 @@
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -40,7 +40,7 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -39,8 +39,8 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCoreImpl/SGFingerCommandImpl.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -40,7 +40,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
class FSGInterpolationSetImpl;
@@ -38,7 +38,7 @@
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
class FSGHandInterpolatorImpl;
@@ -38,7 +38,7 @@
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
class FSGHandInterpolatorImpl;
@@ -39,7 +39,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -41,7 +41,7 @@
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGHapticGloveCalibrationSequenceImpl.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -38,7 +38,7 @@
#include "Containers/Array.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -44,8 +44,8 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCoreImpl/SGDeviceImpl.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -39,8 +39,8 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCoreImpl/SGHapticGloveCalibrationSequenceImpl.h"
#include "SGCoreImpl/SGPlatform.h"
namespace SGCore
{
@@ -38,7 +38,7 @@
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -38,7 +38,7 @@
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
class FSGHandInterpolatorImpl;
@@ -44,8 +44,8 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGPlatform.h"
namespace SGCore
{
@@ -38,7 +38,7 @@
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -39,7 +39,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -39,7 +39,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
class FSGHandInterpolatorImpl;
@@ -44,8 +44,8 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -39,7 +39,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -39,7 +39,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -38,7 +38,7 @@
#include "Containers/UnrealString.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -39,7 +39,7 @@
#include "Math/Vector.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -38,7 +38,7 @@
#include "HAL/Platform.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -40,8 +40,8 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "SGBuildHacks/SGPlatform.h"
#include "SGCoreImpl/SGBuzzCommandImpl.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGTypes/SGCoreTypes.h"
namespace SGCore
@@ -39,7 +39,7 @@
#include "HAL/Platform.h"
#include "Templates/UniquePtr.h"
#include "SGCoreImpl/SGPlatform.h"
#include "SGBuildHacks/SGPlatform.h"
namespace SGCore
{
@@ -58,7 +58,6 @@ public class SenseGloveCoreImpl : ModuleRules
PrivateDependencyModuleNames.AddRange(
new string[]
{
"SenseGloveBuildHacks",
"SenseGloveInterop",
"SenseGloveLog",
"SenseGloveTypes",
@@ -66,6 +65,13 @@ public class SenseGloveCoreImpl : ModuleRules
}
);
PrivateIncludePathModuleNames.AddRange(
new string[]
{
"SenseGloveBuildHacks",
}
);
AddCoreLibrary(Target);
PublicDefinitions.Add("SENSEGLOVE_BUILDING_CORE_IMPL_MODULE");
@@ -146,7 +152,9 @@ public class SenseGloveCoreImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
#if UE_5_2_OR_LATER
#if UE_5_3_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
#elif UE_5_2_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
#elif UE_5_0_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v20"));
@@ -165,7 +173,9 @@ public class SenseGloveCoreImpl : ModuleRules
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
LibraryName = string.Format("lib{0}.a", LibraryName);
#if UE_5_2_OR_LATER
#if UE_5_3_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
#elif UE_5_2_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
#elif UE_5_0_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v20"));
@@ -60,6 +60,7 @@ public class SenseGloveInterop : ModuleRules
PrivateIncludePathModuleNames.AddRange(
new string[]
{
"SenseGloveBuildHacks",
"SenseGloveCoreImpl",
}
);
@@ -57,6 +57,11 @@ USGVirtualHandComponent* UPawnKismetLibrary::GetHandLeft(const ASGPawn* Pawn)
return Pawn->GetHandLeft();
}
USGVirtualHandComponent* UPawnKismetLibrary::GetRealHandLeft(const ASGPawn* Pawn)
{
return Pawn->GetHandLeft();
}
USphereComponent* UPawnKismetLibrary::GetLeftThumbFingertipGrabCollider(const ASGPawn* Pawn)
{
return Pawn->GetLeftThumbFingertipGrabCollider();
@@ -107,6 +112,11 @@ USGVirtualHandComponent* UPawnKismetLibrary::GetHandRight(const ASGPawn* Pawn)
return Pawn->GetHandRight();
}
USGVirtualHandComponent* UPawnKismetLibrary::GetRealHandRight(const ASGPawn* Pawn)
{
return Pawn->GetRealHandRight();
}
USphereComponent* UPawnKismetLibrary::GetRightThumbFingertipGrabCollider(const ASGPawn* Pawn)
{
return Pawn->GetRightThumbFingertipGrabCollider();
@@ -72,8 +72,8 @@ bool UVirtualHandComponentKismetLibrary::IsRight(const USGVirtualHandComponent*
return VirtualHandComponent->IsRight();
}
void UVirtualHandComponentKismetLibrary::SetRight(USGVirtualHandComponent* VirtualHandComponent,
const bool bInRight)
void UVirtualHandComponentKismetLibrary::SetRight(
USGVirtualHandComponent* VirtualHandComponent, const bool bInRight)
{
VirtualHandComponent->SetRight(bInRight);
}
@@ -96,8 +96,8 @@ bool UVirtualHandComponentKismetLibrary::AutoStopsAllHapticsOnEndPlay(
return VirtualHandComponent->AutoStopsAllHapticsOnEndPlay();
}
void UVirtualHandComponentKismetLibrary::SetAutoStopAllHapticsOnEndPlay(USGVirtualHandComponent* VirtualHandComponent,
const bool bInAutoStopAllHapticsOnEndPlay)
void UVirtualHandComponentKismetLibrary::SetAutoStopAllHapticsOnEndPlay(
USGVirtualHandComponent* VirtualHandComponent, const bool bInAutoStopAllHapticsOnEndPlay)
{
VirtualHandComponent->SetAutoStopAllHapticsOnEndPlay(bInAutoStopAllHapticsOnEndPlay);
}
@@ -119,8 +119,8 @@ const FName& UVirtualHandComponentKismetLibrary::GetThumbFingertipGrabSocketName
return VirtualHandComponent->GetThumbFingertipGrabSocketName();
}
void UVirtualHandComponentKismetLibrary::SetThumbFingertipGrabSocketName(USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName)
void UVirtualHandComponentKismetLibrary::SetThumbFingertipGrabSocketName(
USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName)
{
VirtualHandComponent->SetThumbFingertipGrabSocketName(SocketName);
}
@@ -131,8 +131,8 @@ const FName& UVirtualHandComponentKismetLibrary::GetIndexFingertipGrabSocketName
return VirtualHandComponent->GetIndexFingertipGrabSocketName();
}
void UVirtualHandComponentKismetLibrary::SetIndexFingertipGrabSocketName(USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName)
void UVirtualHandComponentKismetLibrary::SetIndexFingertipGrabSocketName(
USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName)
{
VirtualHandComponent->SetIndexFingertipGrabSocketName(SocketName);
}
@@ -143,8 +143,8 @@ const FName& UVirtualHandComponentKismetLibrary::GetMiddleFingertipGrabSocketNam
return VirtualHandComponent->GetMiddleFingertipGrabSocketName();
}
void UVirtualHandComponentKismetLibrary::SetMiddleFingertipGrabSocketName(USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName)
void UVirtualHandComponentKismetLibrary::SetMiddleFingertipGrabSocketName(
USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName)
{
VirtualHandComponent->SetMiddleFingertipGrabSocketName(SocketName);
}
@@ -161,8 +161,8 @@ const FName& UVirtualHandComponentKismetLibrary::GetThumbFingertipTouchSocketNam
return VirtualHandComponent->GetThumbFingertipTouchSocketName();
}
void UVirtualHandComponentKismetLibrary::SetThumbFingertipTouchSocketName(USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName)
void UVirtualHandComponentKismetLibrary::SetThumbFingertipTouchSocketName(
USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName)
{
VirtualHandComponent->SetThumbFingertipTouchSocketName(SocketName);
}
@@ -173,8 +173,8 @@ const FName& UVirtualHandComponentKismetLibrary::GetIndexFingertipTouchSocketNam
return VirtualHandComponent->GetIndexFingertipTouchSocketName();
}
void UVirtualHandComponentKismetLibrary::SetIndexFingertipTouchSocketName(USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName)
void UVirtualHandComponentKismetLibrary::SetIndexFingertipTouchSocketName(
USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName)
{
VirtualHandComponent->SetIndexFingertipTouchSocketName(SocketName);
}
@@ -198,8 +198,8 @@ const FName& UVirtualHandComponentKismetLibrary::GetRingFingertipTouchSocketName
return VirtualHandComponent->GetRingFingertipTouchSocketName();
}
void UVirtualHandComponentKismetLibrary::SetRingFingertipTouchSocketName(USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName)
void UVirtualHandComponentKismetLibrary::SetRingFingertipTouchSocketName(
USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName)
{
VirtualHandComponent->SetRingFingertipTouchSocketName(SocketName);
}
@@ -210,18 +210,32 @@ const FName& UVirtualHandComponentKismetLibrary::GetPinkyFingertipTouchSocketNam
return VirtualHandComponent->GetPinkyFingertipTouchSocketName();
}
void UVirtualHandComponentKismetLibrary::SetPinkyFingertipTouchSocketName(USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName)
void UVirtualHandComponentKismetLibrary::SetPinkyFingertipTouchSocketName(
USGVirtualHandComponent* VirtualHandComponent, const FName& SocketName)
{
VirtualHandComponent->SetPinkyFingertipTouchSocketName(SocketName);
}
const FSGDebugVirtualHandSettings& UVirtualHandComponentKismetLibrary::GetDebugVirtualHandSettings(
const USGVirtualHandComponent* VirtualHandComponent)
{
return VirtualHandComponent->GetDebugVirtualHandSettings();
}
void UVirtualHandComponentKismetLibrary::SetDebugVirtualHandSettings(
USGVirtualHandComponent* VirtualHandComponent,
const FSGDebugVirtualHandSettings& InDebugVirtualHandSettings)
{
VirtualHandComponent->SetDebugVirtualHandSettings(InDebugVirtualHandSettings);
}
bool UVirtualHandComponentKismetLibrary::IsGloveConnected(const USGVirtualHandComponent* VirtualHandComponent)
{
return VirtualHandComponent->IsGloveConnected();
}
USGHapticGlove* UVirtualHandComponentKismetLibrary::GetConnectedGlove(const USGVirtualHandComponent* VirtualHandComponent)
USGHapticGlove* UVirtualHandComponentKismetLibrary::GetConnectedGlove(
const USGVirtualHandComponent* VirtualHandComponent)
{
return VirtualHandComponent->GetConnectedGlove();
}
@@ -71,6 +71,9 @@ public:
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
static USGVirtualHandComponent* GetHandLeft(const ASGPawn* Pawn);
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
static USGVirtualHandComponent* GetRealHandLeft(const ASGPawn* Pawn);
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
static USphereComponent* GetLeftThumbFingertipGrabCollider(const ASGPawn* Pawn);
@@ -101,6 +104,9 @@ public:
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
static USGVirtualHandComponent* GetHandRight(const ASGPawn* Pawn);
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
static USGVirtualHandComponent* GetRealHandRight(const ASGPawn* Pawn);
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
static USphereComponent* GetRightThumbFingertipGrabCollider(const ASGPawn* Pawn);
@@ -44,6 +44,7 @@
#include "UObject/NameTypes.h"
#include "SGKismet/SGBlueprintFunctionLibrary.h"
#include "SGSettings/SGDebugVirtualHandSettings.h"
#include "SGTypes/SGNameArray.h"
#include "SGVirtualHandComponentKismetLibrary.generated.h"
@@ -160,6 +161,14 @@ public:
static void SetPinkyFingertipTouchSocketName(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent,
const FName& SocketName);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
static const FSGDebugVirtualHandSettings& GetDebugVirtualHandSettings(
const USGVirtualHandComponent* VirtualHandComponent);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
static void SetDebugVirtualHandSettings(UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent,
const FSGDebugVirtualHandSettings& InDebugVirtualHandSettings);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
static bool IsGloveConnected(const USGVirtualHandComponent* VirtualHandComponent);
@@ -44,8 +44,8 @@ FSGDebugVirtualHandSettings::FSGDebugVirtualHandSettings()
GizmoLength(1.0f),
GizmoThickness(1.0f),
GizmoXAxisColor(255, 0, 0, 255),
GizmoYAxisColor(255, 0, 0, 255),
GizmoZAxisColor(255, 0, 0, 255),
GizmoYAxisColor(0, 255, 0, 255),
GizmoZAxisColor(0, 0, 255, 255),
bPersistentLines(false),
LifeTimeModifier(1.1f),
DepthPriority(0)
@@ -107,8 +107,6 @@ void USGSettings::Initialize(FSubsystemCollectionBase& Collection)
Super::Initialize(Collection);
SGLOG("Initializing the SenseGlove settings singleton with the engine lifetime...");
SGLOG("The SenseGlove settings singleton has been successfully initialized with the engine lifetime!");
}
@@ -118,7 +116,7 @@ void USGSettings::Deinitialize()
Super::Deinitialize();
Pimpl.Release();
(void)Pimpl.Release();
SGLOG("The SenseGlove settings singleton has been successfully de-initialized!");
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More