Open Billydwilliams opened 7 years ago
turn off autoUpdate of spine objects, or even PIXI.spine.Spine.globalAutoUpdate
, add them to your own animation cycle that runs independent from updateTransform.
PIXI doesn't have pre-made animation ticker, you have to make it yourself, its project-dependent.
PIXI also doesn't have a Stage that can add/remove children from animation cycler automatically on removeChild
, autoUpdates are based on updateTransform and you see the result.
If I turn off auto updating is there a function in spine that I call before I call render on the stage?
I don't really understand your explanation as to why it doesn't work as the only difference between it working and not working is where I am making the removeChild call. Which is at the beginning of my animate loop before rendering the stage instead of in the event trigger function itself. I am also not removing a spine entity from the stage but just a normal PIXI.Sprite.
Edit: I looked at some things and saw there is a new way of doing things involving PIXI.Application. I still do things the old way via creating a renderer and updating it in an animation loop. Is there a downside to this, or is PIXI.Application just a starting point to get people going faster?
you can use old way, Application is for people who dont want to create all that stuff themselves. Using your own RAF is fine ;) https://github.com/pixijs/pixi.js/blob/dev/src/core/Application.js
People like to take care of their update cycle, there are so many things that can be custom-made there! Spine has "update(dt)" function, just pass the delta time there. I dont remember whether its in second or in frames (1 frame is 1/60 second)
Is that update function on a spine to spine basis or can I set it globally to replace the current global one?
its update function on spine instance (PIXI.spine.Spine), you should maintain list of spine objects that belong to the stage and call them all from your update cycle. Dont forget to remove them afterwards.
Basically this is DIY (Do It Yourself) approach. Be grateful, big frameworks dont allow that stuff but pixi is just a small lib ;)
You always have accessable libraries ivan and its much appreciated. While it does give the user great power, it also makes it easy to get lost. So I'm more thankful for the fact that you take time to answer questions. Thanks for all the help.
it also makes it easy to get lost
Thank you! We are working on it ;) Though we wont sacrifice accessibility for it, otherwise it will be phaser all over again.
Right now instead I add the sprite I want removed to a list and remove it myself on the next animation cycle, but I would prefer to just be able to remove it here at will.