• RuntimesUnity
  • [3.8] Zero-frame attach keys on mixTime?

Hi,

I have a number of secondary zero-frame animations that play on higher number tracks, for things like moving an arm+hand to a point in space.

As their only purpose is to get those arms in that place, these animations are zero-frame, so the time it takes for the hand to reach the final destination is based on the mixTime I select (usually one second).

Now, some of those also have attach keys to change the hand image from one type to another (open to closed, for example).

The problem is, this isn't aesthetic. I typically want the hand to close only after reaching its destination, not before.

So, my question...: Is there some way to tell the runtimes to wait for the attach keys to be applied on mixTime, instead of immediately?

I know there are some ways to circumvent this issue, like playing the attach keys on another track, or making 30-frame animations instead of a zero one and play them at a speed that makes them end at the mixTime. But that would mean more complexity in my engine.

It would be great if I could "just" tell the trackEntry to apply the attach keys only at the end of the mixing. Is this possible?

Thank you.

Related Discussions
...
  • Изменено

We have a setting for mixing out, attachmentThreshold:
http://esotericsoftware.com/spine-api-reference#TrackEntry-attachmentThreshold

For mixing in, we don't have a setting. I'm not sure it makes sense, as the animation defines when the attachments change. You could move your attachment keys in your animation to the mix duration, eg 1 second. That wouldn't affect your runtime code unless you want to play the same animation with different mix durations.

Another thought is to separate the pose and the attachment changes into different animations.

Lastly, you could hack the runtimes. AnimationState applyAttachmentTimeline could return before doing anything if the time parameter is < the value of a field you add to TrackEntry.

For mixing in, we don't have a setting. I'm not sure it makes sense, as the animation defines when the attachments change.

Yeah, I'm weird. 😅 I recognize it's a far-fetched question because what I want is to apply attach keys separately from the rest of the keys.

Yesterday, I played around with the first approach you propose (making a non-looped pose animation with the attach keys at frame 30), and it even works with different mix durations by dividing the timeScale by the mixTime, before setting the animation.

The problem with this is that I can only play posing non-looped animations, because if I modify the timeScale for an animation that's supposed to do more than just putting an IK target somewhere, then the cycle repeats at an undesired speed.

So, I'm indeed considering taking those attach keys out of the posing/looping animations.

However, that third proposition you've mentioned is intriguing, although I haven't understood what you mean (I'm not really a programmer). I've found it mentioned here: http://esotericsoftware.com/spine-api-reference#AttachmentTimeline but I can't figure out how to use it to:

  1. Prevent the attach keys contained in the zero-frame animation being applied immediately.
  2. Delaying their execution to a given delay.

Anyway, fiddling with the runtimes at this level is out of my skills, I'm afraid. I'll just use two more tracks for the hands' attachments. Two more to the 30-40 I have. 😆

Thank you.

  • Harald ответили на это сообщение.

    Abelius Anyway, fiddling with the runtimes at this level is out of my skills, I'm afraid. I'll just use two more tracks for the hands' attachments. Two more to the 30-40 I have. 😆

    The problem with this is that I can only play posing non-looped animations, because if I modify the timeScale for an animation that's supposed to do more than just putting an IK target somewhere, then the cycle repeats at an undesired speed.

    I'm not quite sure why you would need to use additional tracks. Why can't you use a non-looping animation at the existing track with the hand position being set e.g. at time 0.0 as before and the hand switching to the closed attachment at e.g. time 1.0? Why would you loop such an animation, when it previously was of duration 0? If you don't mix out the animation, it stays at the last frame anyway.

    You're right, Harald. I was doing that, in fact.

    But I'm insatiable and wanted to do the same automation with posing animations that are also looped (the ones that pose the arm+hand but do a cyclic motion as well), without needing to Set a just pose anim, and then Add the looping one.

    No worries, though. The original question was out of curiosity, and I can see I don't have the knowledge to talk with you guys about the API on the same level. 🥲 PlayMaker junkie here, lol.