• 2D
  • Bitmap Collisions for Randomly-Shaped Objects

Hello, everyone!

I'm a newcomer to Godot. For the past few days, I've been trying to create a system to generate randomly-shaped objects with bitmap colliders. My goal is to make destructible asteroids, and from what I've read on various forums for Godot and other game development tools, using a bitmap to manage collisions seems like my best option.

I found a Python script for creating random polygons on StackOverflow posted by Mike Ounsworth that I rewrote in GDScript. My next step would be to write the random shape to an image file, then use Godot's BitMap. create_from_image_alpha() method to create the bitmap. Every time a part of the asteroid is destroyed, I could update the bitmap and the collider, like u/Migralo in this Reddit thread.

Overall, this system seems somewhat inefficient, so if anyone has any alternative ideas for destructible colliders, please let me know. Otherwise, I have recently been struggling with converting the polygon (an array of vertices) to an image from which I can make a bitmap. Any help is greatly appreciated!