Skip to content

kevinthompson/godot-generate-polygon-from-sprite-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate CollisionPolygon2D Nodes from Sprite2D

A simple tool script for Godot 3 and 4 that generates a collision polygon from a sprite shape.

Compatibile with Godot 3 and 4:

About

These scripts are provided as an example. Your actual implementation will likely require subtle changes to work within your project.

These versions are also optimistic and will likely fail if the referenced nodes or textures do not yet exist. Add the script after setting up your scene, or get your hands dirty and add conditional checks for the relevant data.

For and example of more complex shapes, view the original gist.

Examples

Aseprite Texture Import GIF

Godot Texture Change GIF

Credits

A good chunk of the logic in these scripts was adapted from the code by The Shaggy Dev at https://shaggydev.com/2022/04/13/sprite-collision-polygons/.

About

A simple tool script for Godot 3 and 4 that generates a collision polygon from a sprite shape.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published