How do I draw a shape around a sprite?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BAE

Suppose I have a sprite. I want to be able to look at pixel data so I can derive a polygon 2d based on the sprite’s shape. This just needs to be done in a single computation.

What would be the best way to approach this problem? I would think that the sprite node has to be copied over to a separate viewport, converted into a texture, and analyzed (i.e. use a convex hull algorithm over all non-transparent points), but if there’s another way, let me know.

:bust_in_silhouette: Reply From: Lola

The answer to your question lies here :slight_smile: