Danisimo Posted October 1, 2021 Share Posted October 1, 2021 Hello everyone. I'm using spine animations in a project that I'm working on. As advised on the forums, I've turned autoUpdate off and have implemented manual updates for the spines. They are collected in an array as soon as they are created and are updated on each game tick. This approach has solved a lot of issues however a very strange corner case has come up. I have two spine animations. I want to play the second one when an event from the first one fires. I listen for the event on the first animation and start the second animation inside the callback. This however causes the second animation to render incorrectly on the first frame it's created and but continues to play its animation normally. What happens is that the spine object appears incorrectly positioned and flipped for just one frame. The frame it's created on, then on the next tick it gets updated and animates and renders normally. This does NOT happen if I manually call the update method on the spine animation on the tick I create it and it does not happen with autoUpdate enabled. I'm going to try and create an example to show this behavior I just wanted to make a post and ask in case it's something very obvious that I might be missing. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2021 Share Posted October 1, 2021 > I want to play the second one when an event from the first one fires autoUpdate is a hacky thing that works inside updateTransform(), because pixi doesnt have dedicated methods for animations, thus, creating a race condition. Its supposed to work like that. There was PR for dedicated animations: https://github.com/pixijs/pixijs/pull/4586 , but other members of team didnt understand why i made it. If you have multiple projects, I can make that PR and you'll back it like "ho-ho-ho BIG COMPANY NAME needs this thing" , and then it'll be merged. Can you do that? Quote Link to comment Share on other sites More sharing options...
Danisimo Posted October 1, 2021 Author Share Posted October 1, 2021 (edited) I see. So adding/removing spine animations on events causes issues with updateTransform? I hadn't noticed this until now as this isn't a common use case. I'll see if I can offer your PR some support. The strange thing is. As per your advice on older threads I removed autoUpdate and implemented it as manual updates. Now each spine animation's update method is called on each game tick inside a custom Ticker class. This approach causes issues with adding spine animations on events but reverting to the default autoUpdate fixes it. This is what puzzles me the most. Edited October 1, 2021 by Danisimo Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2021 Share Posted October 1, 2021 (edited) > This approach causes issues with adding spine animations on events but reverting to the default autoUpdate fixes it. This is what puzzles me the most. well, you modify an array when you go through it. it might cause problems, if you save length of array before the for, there are many behaviours Edited October 1, 2021 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.