godotengine / godotengine/godot
CollisionPolygon2D build mode segments
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in Godot 4.2.1.stable.mono
### System information
Windows 10 Home - Godot 4.2.1.stable.mono
### Issue description
I am making a worms type game using 2d collision polygons as colliders for the map, the problem comes when I use segment build mode for the polygons along with the "default 2d character body controller" which causes the character to make a weird vibration in some corners or even on flat terrain.
This doesn't happen when I use solid build mode, but I really need to use segment mode because I also have holes in the terrain which are also 2d polygon collisions with segment build mode.
With rigidbodies instead there seems to be no problems with either build mode.
Weird corner vibration
https://github.com/godotengine/godot/assets/59151174/c3651d96-12d1-41ba-85b3-30484eff9b0b
Flat terrain vibration
https://github.com/godotengine/godot/assets/59151174/a8ebc7e7-1202-450c-a98a-4c92367e3646
Note: I using a custom marching squares algorithm for tracing the contour of the terrain, that also takes into account holes, but i dont think there is any problem with that.
### Steps to reproduce
Run the proyect and collide with the corner seen in the first video using the left and right arrow keys to move and space for jumping, you can pan the camera with the right click, you can spawn a rigidbody with the left click, and zoom in and out with the up and down arrow keys
### Minimal reproduction project (MRP)
[Worms-clone.zip](https://github.com/godotengine/godot/files/13979778/Worms-clone.zip)
Contributor guide
Research direction
Start by running the linked Worms-clone.zip minimal reproduction and follow the listed controls to reproduce vibration with CollisionPolygon2D segment mode and the default 2D character body controller. Compare the corner and flat-terrain cases with solid mode and rigidbodies; done means the reported CharacterBody2D vibration is explained and corrected without breaking segment-mode terrain or holes.
Written by the indexing model from the issue text.
Assessment
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100