Is there a good reason for the limit of Physics2D layers to 32?

Godot Version



I’m making an RTS like game and require a lot of physics2d layers for unit interactions and have reach the limit while wanting more.
In my case (collison, hitbox, hurtbox, selectbox) * (player + enemy + neutral) * (ground + air) as well is a number of layers for map information.

Is there a good reason for the limit to 32 layers, or could this easily be increased to 64 or 256 layer?

Thank you very much for any help, godot is amazing and I cant wait to contribute back to the commuity.

The layer and mask system uses a 32 bit unsigned integer that’s why there’s a 32 layer limit.

I’m not sure if that can be easily changed to use a 64 bit unsigned integer.

You could use a less detailed layer/mask system and use groups to filter out objects. Groups are unlimited.

1 Like

It can’t be changed without breaking compatibility

1 Like