godotengine / godotengine/godot
CollisionPolygon2D -- Debug collision shape only shows outline in exported projects
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org
### System information
Godot v4.3.stable - Windows 10.0.22631 - GLES3 (Compatibility) - NVIDIA GeForce RTX 4070 Ti (NVIDIA; 32.0.15.6614) - AMD Ryzen 9 7950X 16-Core Processor (32 Threads)
### Issue description
In the Godot editor, there is an option under Debug > Visible Collision Shapes to make collision shapes visible while the game is running.
The appearance matches what is visible in the editor window.
To enable this feature for exported projects, one must add the following line of code to the scene:
`get_tree().set_debug_collisions_hint(true)`
However, this only appears to work for CollisionShape2D nodes in exported projects.
CollisionPolygon2D nodes will only have the outline of their collision shape visible in exported projects.
In editor the whole (filled) collision polygon is visible.
### Steps to reproduce
Open the attached project.
Inspect the scene in the editor before running to see how the collision shapes should look in-game.
Run the project and verify that the scene appears as expected (root node has a script attached to enable visible debug shapes.)
Export the project to Windows .exe or Web build.
Run the exported project and see that the CollisionPolygon2D only shows the shape outline.
### Minimal reproduction project (MRP)
[new-game-project.zip](https://github.com/user-attachments/files/17982291/new-game-project.zip)


Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached minimal reproduction project and the root script that calls set_debug_collisions_hint(true). Compare Visible Collision Shapes in the editor, a regular run, and exported Windows or Web builds, focusing on CollisionPolygon2D versus CollisionShape2D. Done means exported projects display filled CollisionPolygon2D debug shapes rather than only their outlines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100