Open KoBeWi opened 5 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:
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.
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.
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.
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)
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.
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
Would you accept a PR for this (at least for 2D)?
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
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.
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 >_> (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). 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.