After reading source code of AnimatedSprite2D it seems there is no support for manipulating bones of a sprite. It would be great to have such functionality. Now very simple action like aiming rifle to the position of cursor is not really doable with keyframe animations. This of course should blend with executing animation so we can have running and aiming to arbitrary direction.
The AnimatedSprite2D does not have an API for bone control, but it creates internal child scene nodes with StaticSprite2D components for each bone, so in theory you should be able to get at these and manipulate their positions. However I haven’t tested that in practice so I don’t know if it interferes with the animation playback. At least trying to manipulate a child node with a currently playing animation track would lead to conflicts. Aster will likely know better.
Is Aster (aster2013?) sort of responsible for 2d animation stuff? Because i have here this animated spriter character which is proprietary and i cant really post it publicly, and it has “limp leg”. I was wondering whom i could send it privately to hopefully get bug fixed.
Alright, thanks. By the way manipulating nodes does completely nothing when animation is playing. I guess animation just re-sets positions of sprites before screen updates. So feature request still stands.
Hello cadaver - I am trying to add new nodes to the bone nodes of my AnimatedSprite2D made with Spriter and it’s not clear to me where these scene bones with StaticSprite2D components that you are mentioning are created. Can you please offer some direction?
What I want to do is basically attach particle effects and stuff to certain bones.
There’s practically no use directing questions of the 2D-related classes specifically to me. I have little knowledge of them; mostly just fixed small bugs where I could.
Took a look at the code and I believe Aster changed the implementation since this thread was initially started. Originally it created child StaticSprites; now it no longer does that, it just lets the animation implementation update its internal skeleton, and generates vertex data from that. That can result in better performance (avoid extra overhead of the child nodes) but loses the flexibility to attach other objects.
Thanks for the follow-up! I can’t seem to find this vertex data and attempt to attach to it. Can you please point me to the member that has it or can you suggest anything else I might be able to use to that end? - I am OK with a performance hit.
Follow the code from AnimatedSprite2D::UpdateSourceBatches() onward. It uses either Spine (closed source, not enabled by default) or Spriter animations. For Spriter, look further into AnimatedSprite2D::UpdateSourceBatchesSpriter(); I think you will find that you can not add attachments (at least using Urho nodes) easily without extensive surgery of the code.