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

This commit is contained in:
Mamadou Babaei
2024-08-16 18:00:53 +02:00
parent a931a1c798
commit 083157e6b9
@@ -100,6 +100,8 @@ struct USGVirtualHandComponent::FImpl
************************/
FCollisionResponseContainer CachedCollisionResponse;
ECollisionEnabled::Type CachedCollisionEnabled;
bool bCachedGenerateOverlapEvents;
/************************
* Owner object
@@ -468,7 +470,10 @@ FRotator USGVirtualHandComponent::GetHandBoneRefRotation(const int32 Joint) cons
}
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()
{
CachedCollisionEnabled = Owner->GetCollisionEnabled();
CachedCollisionResponse = Owner->GetCollisionResponseToChannels();
bCachedGenerateOverlapEvents = Owner->GetGenerateOverlapEvents();
Owner->SetCollisionResponseToAllChannels(ECR_Ignore);
Owner->SetCollisionEnabled(ECollisionEnabled::NoCollision);
Owner->SetGenerateOverlapEvents(false);
}
void USGVirtualHandComponent::FImpl::RestoreCollisionResponse() const
{
Owner->SetCollisionResponseToChannels(CachedCollisionResponse);
Owner->SetCollisionEnabled(CachedCollisionEnabled);
Owner->SetGenerateOverlapEvents(bCachedGenerateOverlapEvents);
}
void USGVirtualHandComponent::FImpl::SetVisibility(const bool bInVisible)