Grain

Hello! I'm new to spine and i'm a student trying to learn the basic pipeline for my work.

Recently, I'm implementing the runtime plugin with some stuffs i need and this time i'm trying to make a ground constraints system.
(stuff like this -> https://www.youtube.com/watch?v=yYdbTwvnD3c&t=247s)

In this video, the component that handles the tracing and adjusting is attached to the location where the bone should be located before adjusting the location.

like this, I want to know how to get the location of a bone that has not affected by SpineBoneDriverComponent or something else.
Grain
  • Сообщения: 6

Mario

You can get a bone's transform in C++ or via blueprints as described here: spine-ue4 Runtime Documentation: Getting and Setting Bone Transforms
Аватара пользователя
Mario

Mario
  • Сообщения: 2628

Grain

Ahh! Thank you for reply, and sorry for late reply.

But sadly, your answer was a quite far from what i expected to get.

Of cource, we can get a bone's world transform by using the function that mentioned in the link you gave.
But the problem is, when i try to modify a bone's location in runtime through code or something,
(through like USpineBoneDriverComponent...) the transform i got from function 'GetBoneWorldTransform' is affected by the modification, and it is not what i wanted.

what I need is the transform that is "recorded (saved)" in the timeline of animation, and NOT affected by such modification.
Because this is essential for a system like "IK adjustment for terrain or collision" to certain the location that need for tracing.

BUT, somehow i managed to implement the system i needed, so i think we can close this thread.




BTW, can i ask you if you are planning to add some rigging system for level sequence?
Literally, it will be stunning!
and it's just my opinion but i think the reason that many developers who chose to use a dynamic 2D animation system like Spine in their project is to boost their project by simplifying some task like drawing each animation frames for the scene.
so adding rigging system for level sequence will enhance that point even further, and make this awesome software more appealing to customer.
Grain
  • Сообщения: 6

Nate

A bone's world transform is recomputed each frame from the local transform. You could change the local transform, but even then the local transform is usually overwritten by applying an animation. That is why generally you apply an animation, then make any further adjustments needed. This happens each frame. The adjustments can be directly to the world transform, or you can make adjustments to the local transform and then recompute the work transform via Skeleton updateWorldTransform.

I'm not sure Spine is the best choice for rigging an entire level. Likely that needs a fair amount of game toolkit specific optimizations and UI. Spine is great for animations used throughout a level, of course.
Аватара пользователя
Nate

Nate
  • Сообщения: 11345

Grain

I don't know if other runtime APIs work differently or not, but in ue4 runtime module, function updateWorldTransform does not work properly in some occasion.

like, when i set a animation that does not have a timeline for specific bone. just like common behavior of foot bone in Idle animation. (because we don't animate foot bone in Idle animation usually).

Actually it is not a problem of updateWorldTransform function. this problem came from the way how the function bool Spine::AnimationState::apply(Skeleton& skeleton) works.

If an animation does not have the bone's timeline, that bone will not be updated by that animation in any circumstances in current workflow of USpineSkeletonAnimationComponent::TickInternal();

if you want i can share a sample code on here as soon as i return to my home. (i'm currently on a vacation)



and, i think my explanation about "rigging system for level sequence" was insufficient.



This was what i was talking about. because spine exports and assets uses a whole different system from FBX, we can't use such great system without grinding some effort on implementation.
Grain
  • Сообщения: 6

Nate

Grain писал(а):If an animation does not have the bone's timeline, that bone will not be updated by that animation
Applying an animation only modifies the properties it keys. This is how it is designed to work. Local transform values not modified by animations keep their values until something changes them. Skeleton updateWorldTransform computes world transform values using the local transforms.

AnimationState will reset values that animations have made back to the setup pose when the animation will no longer be applied. However, this does not happen if you use AnimationState clearTrack or TrackEntry endTime.

Please let us know if you are still having a problem.

FBX doesn't provide the functionality needed for Spine animations, that is why Spine has it's own runtimes. Using a game specific toolkit to manipulate Spine skeletons gets complex for the same reasons -- the game toolkit doesn't have the functionality needed for what Spine provides. Rebuilding the Spine editor in a game toolkit would be significant work. However, you can have bones in your Spine skeletons follow a UE4 game object. That way you can animate/manipulate the UE4 game object to manipulate the Spine skeleton.
Аватара пользователя
Nate

Nate
  • Сообщения: 11345

Grain

As i mentioned earlier, i could handle the problem somehow.

It turned out the problem was the bug of Unreal engine's UHT / signature system.
UFUNCTION()
void AdjustTargetIKBone(USpineSkeletonComponent* skeleton);

UFUNCTION()
void ResetTargetIKBone(USpineSkeletonComponent* skeleton);
basically i tried to save a bone' transform before adjusting the bone's location,
and reset it after updating the world transform of skeleton.

The func 'AdjustTargetIKBone' was supposed to be bound to BeforeUpdateWorldTransform delegate,
and the func 'ResetTargetIKBone' was supposed to be bound to AfterUpdateWorldTransform delegate.

But sadly, UHT system had a difficulty to identify each function to each for some reason, (i guess it is because both function had identical UFUNCTION specifier and also exactly same signature), so 'AdjustTargetIKBone' had been bound to AfterUpdateWorldTransform instead of
'ResetTargetIKBone' function.

this is why my logic was broken at the moment(because one of the function even didn't be called properly). and I, didn't know anything about this bug, AND after trying to fix my logic about 30 times, was convinced to think this is a problem of the plugin.

Well, it was a quite annoying experience. for sure. >:C
I'm sorry for this whole situation and I'd like to say thank you for helping my situation.
Grain
  • Сообщения: 6


Вернуться в Runtimes