Godot-proposals: Option to hide collision shapes of instanced scenes

Created on 10 Sep 2019  路  9Comments  路  Source: godotengine/godot-proposals

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.

editor

Most helpful comment

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.

All 9 comments

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

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.

@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).

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.

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

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

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.

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.

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.

Was this page helpful?
0 / 5 - 0 ratings