godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Option to hide collision shapes of instanced scenes #54

Open KoBeWi opened 5 years ago

KoBeWi commented 5 years ago

Describe the project you are working on: A complex game with lots of object types.

Describe how this feature / enhancement will help your project: I have one or more collision shapes on almost every object in my game. These objects are of course separate scenes, instanced in maps. Seeing these shapes all over the scene hurts readability and is... annoying >_> image (ignore placeholder sprites)

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work: Well, this could be editor option. After enabling, if you instance a scene with collision shapes, the shapes would be hidden (similar to how they don't show while playing). image Much more pleasant to look at, isn't it?

They would still be visible in the original scene.

EDIT: I just noticed the View menu in the editor. Perfect place for this option.

Describe implementation detail for your proposal (in code), if possible: For 2D, I guess it's about adding another case here https://github.com/godotengine/godot/blob/24e1039eb6fe32115e8d1a62a84965e9be19a2ed/scene/2d/collision_shape_2d.cpp#L104 which would check whether the shape is part of instanced scene or its own.

If this enhancement will not be used often, can it be worked around with a few lines of script?: You can manually turn off the visibility of the shapes, but that state is needlessly saved in the scene and also you need to toggle it each time you want to edit the shape. It's just bothersome.

Is there a reason why this should be core and not an add-on in the asset library?: It's a little QoL thing. Not sure if possible with a reasonable plugin (reasonable i.e. not adding any additional steps to simple auto-hiding).

EDIT: So I don't really need this anymore, but it has some support and also apparently it would be still useful in 3D.

madmiraal commented 4 years ago

I don't think this is a physics proposal. I think it's an editor proposal.

That been said, I think this is unnecessary, because it can achieved by simply changing the order of the Sprite and CollisionShape2D nodes.

If the CollisionShape2D node is placed before the Sprite node, the Sprite is drawn on top of the CollisionShape2D node, and visa versa: CollisionShape1 CollisionShape2

KoBeWi commented 4 years ago

If the CollisionShape2D node is placed before the Sprite node, the Sprite is drawn on top of the CollisionShape2D node, and visa versa:

Irregular Sprites will get a very visible background though. Also I sometimes make additional shapes for detectors and it's impossible to cover them.

nhold commented 4 years ago

@madmiraal That won't work if the parent node is the sprite or the collision shape is much bigger than the sprite.

It makes sense to be able to hide helpers entirely in the editor (Like any collision shape).

KoBeWi commented 3 years ago

Putting sprites on the top turned out to be plausible solution. It just requires reordering scenes and bigger colliders are rare enough that hiding them manually is ok. So I don't think this proposal is worth it to be implemented.

Zireael07 commented 3 years ago

@KoBeWi: Sprites on top is only a solution for 2D. For 3D, the problem remains. Please reopen?

KoBeWi commented 3 years ago

I didn't even consider 3D for this feature, but ok.

madmiraal commented 3 years ago

Sprites on top is only a solution for 2D. For 3D, the problem remains.

Unless I'm missing something, the same plausible solution applies to 3D too i.e. put the MeshInstance after the CollisionShape.

nhold commented 3 years ago

Putting sprites on the top turned out to be plausible solution. It just requires reordering scenes and bigger colliders are rare enough that hiding them manually is ok. So I don't think this proposal is worth it to be implemented.

Bigger collision shapes are rare? Vision radius/arc. Ability collision shapes/'hidden' trap collision shapes. There are many ways to have a collision shape that pollutes the editor (Even if it is possible to re-order scenes). I still think this is a good proposal for 2D.

If we add (Or already exists, I don't know) a hook for when a scene is instanced\loaded in editor we could potentially have our own toggle.

Calinou commented 3 years ago

If https://github.com/godotengine/godot/pull/40123 was implemented for 2D, it would likely address this proposal since you could use a very low opacity.

jordanlis commented 3 years ago

I too have many objects with collision shapes : sometimes I need to see them, sometime, I don't. When I don't, I have to open each scene and hide separatly the collisionShape. Which is a bit annoying. we could have the option in the menu "Debug -> Hide all collision shapes" it could be great. Another option would be to have this option in the editor menu, in the editor view.

GoldenSkullArt commented 3 years ago

None of the suggested "solutions" are really a solution if you have a lot of objects in the scene, to just toggle the visibility of all scene-object's colliders in the parent scene would help sooo much, then I don't have to manually toggle them all on and off, when debugging or when not debugging.

me2beats commented 2 years ago

yep this is kinda annoying isn't it somewhere in theme settings (if so I could just set its alpha). or the color is hardcoded? And I guess it is drawn using a draw_.. function изображение

PS when I set it behind the sprite, it looks better, but still not ideal (as if it were invisible) изображение

Calinou commented 2 years ago

yep this is kinda annoying isn't it somewhere in theme settings (if so I could just set its alpha). or the color is hardcoded? And I guess it is drawn using a draw_.. function

You should be able to change the Self Modulate property's alpha value on the CollisionShape2D. This is only possible in 2D though, not 3D.

me2beats commented 2 years ago

having it in editor theme for being able to tweak it globally + an option to hide it completely or only for scene instances, still looks more convenient to me

Pacheco95 commented 1 year ago

Would you accept a PR for this (at least for 2D)?

starblinky commented 1 year ago

As a new user, this is something I would really appreciate as a feature. Sometimes I want to turn off collider visibility just to see the aesthetic of the scene. Or because the visual clutter is making things hard for working in. And with large area2d colliders for enemy vision for example, the entire scene becomes engulfed in blue circles, which can be annoying when you want to quickly click or move other objects around the scene, but are being blocked by these colliders.

Something like View > [Toggle Collider Visibility], or something to toggle visibility off/on

Calinou commented 1 year ago

Would you accept a PR for this (at least for 2D)?

Yes, but we try to keep feature parity between the 2D and 3D editor display as much as possible (in particular when inconsistencies can cause confusion). So we'd prefer if the PR addressed this for both 2D and 3D at the same time.

That said, if you don't know how to implement this in 3D, feel free to open a PR anyway and someone else may be able to assist.