try to disable collision alltogether when the hand mesh is not visible

This commit is contained in:
Mamadou Babaei
2024-08-16 18:01:37 +02:00
parent 036b382109
commit 76f5dda49a
@@ -100,6 +100,8 @@ struct USGVirtualHandComponent::FImpl
************************/ ************************/
FCollisionResponseContainer CachedCollisionResponse; FCollisionResponseContainer CachedCollisionResponse;
ECollisionEnabled::Type CachedCollisionEnabled;
bool bCachedGenerateOverlapEvents;
/************************ /************************
* Owner object * Owner object
@@ -468,7 +470,10 @@ FRotator USGVirtualHandComponent::GetHandBoneRefRotation(const int32 Joint) cons
} }
USGVirtualHandComponent::FImpl::FImpl(USGVirtualHandComponent* InOwner) USGVirtualHandComponent::FImpl::FImpl(USGVirtualHandComponent* InOwner)
: Owner(InOwner) : CachedCollisionEnabled(InOwner->GetCollisionEnabled()),
bCachedGenerateOverlapEvents(InOwner->GetGenerateOverlapEvents()),
Owner(InOwner)
{ {
} }
@@ -590,13 +595,19 @@ const FReferenceSkeleton& USGVirtualHandComponent::FImpl::GetRefSkeleton() const
void USGVirtualHandComponent::FImpl::DisableCollisionResponse() void USGVirtualHandComponent::FImpl::DisableCollisionResponse()
{ {
CachedCollisionEnabled = Owner->GetCollisionEnabled();
CachedCollisionResponse = Owner->GetCollisionResponseToChannels(); CachedCollisionResponse = Owner->GetCollisionResponseToChannels();
bCachedGenerateOverlapEvents = Owner->GetGenerateOverlapEvents();
Owner->SetCollisionResponseToAllChannels(ECR_Ignore); Owner->SetCollisionResponseToAllChannels(ECR_Ignore);
Owner->SetCollisionEnabled(ECollisionEnabled::NoCollision);
Owner->SetGenerateOverlapEvents(false);
} }
void USGVirtualHandComponent::FImpl::RestoreCollisionResponse() const void USGVirtualHandComponent::FImpl::RestoreCollisionResponse() const
{ {
Owner->SetCollisionResponseToChannels(CachedCollisionResponse); Owner->SetCollisionResponseToChannels(CachedCollisionResponse);
Owner->SetCollisionEnabled(CachedCollisionEnabled);
Owner->SetGenerateOverlapEvents(bCachedGenerateOverlapEvents);
} }
void USGVirtualHandComponent::FImpl::SetVisibility(const bool bInVisible) void USGVirtualHandComponent::FImpl::SetVisibility(const bool bInVisible)