Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collision Layers and Mask names should be zero-indexed, consistent with underlying collision bit indexes #9375

Closed
Proggle opened this issue Mar 24, 2024 · 2 comments
Labels

Comments

@Proggle
Copy link

Proggle commented Mar 24, 2024

Describe the project you are working on

A game using collisions layers and masks

Describe the problem or limitation you are having in your project

It's needlessly confusing that collision layers are 1-indexed, but the underlying bits are 0-indexed. They should be consistent.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Start counting layer names at 0 instead of 1, that way it will match the bits, so you don't have to worry about off-by-one errors every time you want to set layer 9 and have to mentally correct your set_collision_mask_bit to hit bit 8 instead.

image

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Just change how the UI counts things, I'm pretty sure that the layer numbers are purely editor-space and don't get reflected in the underlying engine

If this enhancement will not be used often, can it be worked around with a few lines of script?

Core engine functionality, can't be worked around.

Is there a reason why this should be core and not an add-on in the asset library?

This is pretty core to how the editor displays layers.

@Proggle
Copy link
Author

Proggle commented Mar 24, 2024

Oh, this was actually changed in v4 so set_collision_mask_value takes the layer number. Still think it's weird that they're off-by-one, though.

@Calinou
Copy link
Member

Calinou commented Mar 26, 2024

See #2050, which was implemented by godotengine/godot#44809 but was then reverted by godotengine/godot#51532.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants