Set the anchor of a sprite

I was wondering if anyone has a clever solution or plugin for setting the anchor of a sprite? Like, associating a bit of x,y data with the sprite as a whole, or maybe even per-cell and (maybe most importantly) displaying it in the editor as a handle that can be dragged around and changed?

Use case could be setting where the “feet” are for a platformer, or the rotation center for a top-down sprite.

Not really at the feature request level for me, but is this something that could be added as a plugin? GUI elements and everything?

I just use a layer with coloured pixels in it, but I suspect my situation is simpler than yours.

That could work for me but I’d have to make my importer more complex. This is definitely more pie-in-the-sky level, so I’d love to hear more about what you’re doing and see if that’d work for what I was thinking, if you’ve got the time.

Do you export the layers separately and associate them via filename or something? Right now I’m basically exporting every frame for every sprite as a separate file and using TexturePacker to make them into an atlas, but the associated JSON files with the animation data keeps the filenames and frame names so I can get at it later.

Seriously, you’re like the fastest draw in the west on these forums. :smile: Thanks for your help!

I don’t actually check this forum that often, seems I just have fortuitous timing xP

My pivots are used to correctly position sprites relative to the entity’s hitbox, so I only really need one pivot per document, representing the hitbox. In my pivot layer, I have both the hitbox and the pivot drawn. Instead of moving the pivot, I actually move the cell, so in every frame, the pivot/hitbox stay constant, and I can see how the sprite moves relative to them. I find this easier to work with while animating, it makes it easier to see jitters and motion mismatches. When the hitbox changes (e.g. for the crouch animation, or for a different character), I position it so it has the same pivot point.
image
I have a tool that converts Aseprite spritesheet JSON into a format my engine can use, and it has a field where I can input the position of the pivot, and it automatically adjusts the render offsets of all the trimmed cells to use that pivot. I input this manually (I can easily get the position in Aseprite), but since it’s one per spritesheet and I have only a few spritesheets with many sprites each, it’s not a lot of manual work.
The tool also has a field for the position of the spritesheet in an atlas, so if I put the spritesheet image into an atlas, manually or not, I can account for that. This is again manual, but as I mentioned, I don’t have many spritesheets, because each one contains a lot, so it’s not a lot of manual work.

It would not be difficult to modify my tool so that I can export this same document as a spritesheet without trimming and packing and feed that image and its metadata into the tool so that it could automatically extract moving pivots, though. Since the frames would be the same between both documents (Aseprite still outputs separate frame data for identical frames), the metadata can be assumed to match, so the processing should be fairly simple. I’d just look at each cell in the pivot sheet and look for the pixel of the colour I want. I haven’t needed this yet, so I haven’t implemented it.