pass outer as the worldcontextobject to glovetracker::getinstance

This commit is contained in:
Mamadou Babaei
2024-08-16 18:00:54 +02:00
parent ce8a01dc05
commit 01f487a87c
@@ -310,7 +310,7 @@ void USGVirtualHandComponent::UninitializeComponent()
{
Super::UninitializeComponent();
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(this)};
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(GetOuter())};
USGHapticGlove* Glove{IsValid(GloveTracker) ? GloveTracker->GetGlove(IsRight()) : nullptr};
if (IsValid(Glove) && Glove->IsConnected() && AutoStopsAllHapticsOnEndPlay())
{
@@ -329,7 +329,7 @@ void USGVirtualHandComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(this)};
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(GetOuter())};
USGHapticGlove* Glove{IsValid(GloveTracker) ? GloveTracker->GetGlove(IsRight()) : nullptr};
if (IsValid(Glove) && Glove->IsConnected() && AutoStopsAllHapticsOnEndPlay())
{
@@ -383,14 +383,14 @@ void USGVirtualHandComponent::EditorTick(
bool USGVirtualHandComponent::IsGloveConnected() const
{
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(this)};
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(GetOuter())};
const USGHapticGlove* Glove{IsValid(GloveTracker) ? GloveTracker->GetGlove(IsRight()) : nullptr};
return IsValid(Glove);
}
USGHapticGlove* USGVirtualHandComponent::GetConnectedGlove() const
{
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(this)};
const USGGloveTracker* GloveTracker{USGGloveTracker::GetInstance(GetOuter())};
USGHapticGlove* Glove{IsValid(GloveTracker) ? GloveTracker->GetGlove(IsRight()) : nullptr};
return Glove;
}