diff --git a/spine-ue4/Content/Maps/example.umap b/spine-ue4/Content/Maps/example.umap index bf3bc2f02..ad6e14d7c 100644 Binary files a/spine-ue4/Content/Maps/example.umap and b/spine-ue4/Content/Maps/example.umap differ diff --git a/spine-ue4/Content/SpineBoy/Hover_Blueprint.uasset b/spine-ue4/Content/SpineBoy/Hover_Blueprint.uasset new file mode 100644 index 000000000..198a9c5e1 Binary files /dev/null and b/spine-ue4/Content/SpineBoy/Hover_Blueprint.uasset differ diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp index 6676534ec..9d1776330 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp @@ -13,7 +13,7 @@ void USpineBoneDriverComponent::BeginPlay () { void USpineBoneDriverComponent::BeforeUpdateWorldTransform(USpineSkeletonComponent* skeleton) { AActor* owner = GetOwner(); - if (owner) { + if (owner && skeleton == lastBoundComponent) { skeleton->SetBoneWorldPosition(BoneName, owner->GetActorLocation() ); } } @@ -25,7 +25,8 @@ void USpineBoneDriverComponent::TickComponent (float DeltaTime, ELevelTick TickT USpineSkeletonComponent* skeleton = static_cast(Target->GetComponentByClass(USpineSkeletonComponent::StaticClass())); if (skeleton != lastBoundComponent) { // if (lastBoundComponent) lastBoundComponent->BeforeUpdateWorldTransform.RemoveAll(this); - skeleton->BeforeUpdateWorldTransform.AddDynamic(this, &USpineBoneDriverComponent::BeforeUpdateWorldTransform); + if (!skeleton->BeforeUpdateWorldTransform.GetAllObjects().Contains(this)) + skeleton->BeforeUpdateWorldTransform.AddDynamic(this, &USpineBoneDriverComponent::BeforeUpdateWorldTransform); lastBoundComponent = skeleton; } } diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp index 60596fcaa..1703f4f7c 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp @@ -73,9 +73,13 @@ void USpineSkeletonComponent::SetBoneWorldPosition (const FString& BoneName, con } baseTransform = baseTransform.Inverse(); - FVector localPosition = baseTransform.TransformVector(position); + FVector localPosition = baseTransform.TransformPosition(position); float localX = 0, localY = 0; - spBone_worldToLocal(bone, localPosition.X, localPosition.Z, &localX, &localY); + if (bone->parent) { + spBone_worldToLocal(bone->parent, localPosition.X, localPosition.Z, &localX, &localY); + } else { + spBone_worldToLocal(bone, localPosition.X, localPosition.Z, &localX, &localY); + } bone->x = localX; bone->y = localY; }