From 75c4b6f98d22da35e41f193080a9ee526bb61efd Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Fri, 10 Mar 2023 15:25:27 +0100 Subject: [PATCH] working in-editor hand animation --- .../SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp | 5 +++++ .../SenseGlove/Components/SGVirtualHandComponent.cpp | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Source/SenseGlove/Private/SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp b/Source/SenseGlove/Private/SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp index f64ce44d..b9f13fd5 100644 --- a/Source/SenseGlove/Private/SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Animation/SGVirtualHandAnimInstanceProxy.cpp @@ -71,6 +71,11 @@ void FSGVirtualHandAnimInstanceProxy::PreEvaluateAnimation(UAnimInstance* InAnim return; } + if (!VirtualHand->IsGloveConnected()) + { + return; + } + BonesRotations.Empty(); BonesRotations = VirtualHand->GetFingersBonesRotations(); } diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp index 4be48b43..889bd209 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp @@ -173,6 +173,7 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec bTickInEditor = true; bNeverNeedsRenderUpdate = false; bAllowConcurrentTick = true; + SetUpdateAnimationInEditor(true); SetCastShadow(true); SetCastHiddenShadow(false); @@ -335,6 +336,11 @@ TMap USGVirtualHandComponent::GetFingersBonesRotations() { TMap Rotations; + if(!IsGloveConnected()) + { + return MoveTemp(Rotations); + } + const USGHandPose* HandPose = GetHandPose(); if (!IsValid(HandPose)) {