godotengine / godotengine/godot
Scaled 2d collisions break sliding through `move_and_slide()`
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in 4.2 and 4.3
### System information
Godot v4.3.stable - macOS 14.6.1 - Vulkan (Mobile) - integrated Apple M3 Max - Apple M3 Max (14 Threads)
### Issue description
I'm making a tower defense game ([Rift Riff](https://store.steampowered.com/app/2800900/Rift_Riff/)) which is a non-tile-based isometric game. To match object collisions with the isometric graphics, I regularly use `CollisionShape2D` with it's shape set to a `ShapeCircle2D` and set the `CollisionShape2D`s transform scale to `1.0, 0.7` so that the collision and graphics match.
However, for entities that move, I've found that this often breaks the sliding behavior in `move_and_slide()`. As scaling the collision works, both technically in the game and visually in the editor, and doesn't give any errors, I believe this is a bug and not unsupported behavior. If this is unsupported behavior (which would be very undesirable for my game) then perhaps the transform scaling property of `CollisionShape2D`s should be read only or perhaps show a warning when scale is adjusted.
An example from within my game:
https://github.com/user-attachments/assets/412e0806-8bdd-4d01-a774-0b18446da1a5
And here an example when the `CollisionShape2D`s transform scale is simply `1.0, 1.0` (which works flawlessly):
https://github.com/user-attachments/assets/8825bd23-e690-4931-a58c-7c164e8ef744
Here a small vid of the MRP I created to show the faulty behavior:
https://github.com/user-attachments/assets/f578258e-58cd-437f-b593-bdcd076d3894
### Steps to reproduce
Play the MRP and notice how the characters with scaled colliders can get stuck at a place that the normal colliders don't.
### Minimal reproduction project (MRP)
[slide-fail.zip](https://github.com/user-attachments/files/16977720/slide-fail.zip)
Contributor guide
Research direction
Start by running the attached slide-fail.zip minimal reproduction and compare movement with CollisionShape2D scale set to 1.0, 0.7 versus 1.0, 1.0. Trace the scaled-collider path used by move_and_slide() and its collision sliding behavior. Done means scaled 2D collisions no longer cause characters to get stuck, with regression coverage for the reproduced case.
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
- 35/100