diff --git a/spine-ue4/Content/GettingStarted/Blueprints/UmgRaptor.uasset b/spine-ue4/Content/GettingStarted/Blueprints/UmgRaptor.uasset index eff46de64..5e8049aff 100644 Binary files a/spine-ue4/Content/GettingStarted/Blueprints/UmgRaptor.uasset and b/spine-ue4/Content/GettingStarted/Blueprints/UmgRaptor.uasset differ diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp index 5e9cdc742..484b6aa2a 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp @@ -331,6 +331,25 @@ bool USpineWidget::HasBone(const FString BoneName) { return false; } +FTransform USpineWidget::GetBoneTransform(const FString& BoneName) { + CheckState(); + if (skeleton) { + Bone *bone = skeleton->findBone(TCHAR_TO_UTF8(*BoneName)); + if (!bone) return FTransform(); + + FMatrix localTransform; + localTransform.SetIdentity(); + localTransform.SetAxis(2, FVector(bone->getA(), 0, bone->getC())); + localTransform.SetAxis(0, FVector(bone->getB(), 0, bone->getD())); + localTransform.SetOrigin(FVector(bone->getWorldX(), 0, bone->getWorldY())); + + FTransform result; + result.SetFromMatrix(localTransform); + return result; + } + return FTransform(); +} + void USpineWidget::GetSlots(TArray &Slots) { CheckState(); if (skeleton) { diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h index 627eeca68..347905fb6 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h @@ -132,6 +132,9 @@ public: UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton") bool HasBone(const FString BoneName); + UFUNCTION(BlueprintCallable, Category = "Components|Spine|Skeleton") + FTransform GetBoneTransform(const FString &BoneName); + UFUNCTION(BlueprintPure, Category = "Components|Spine|Skeleton") void GetSlots(TArray &Slots);