godotengine / godotengine/godot
CharacterBody2D without velocity get sticky collision
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Reproducible:
v4.3.rc1.official [e343dbbcc]
v4.2.2.stable
v4.2.1.stable
v4.1.1.stable
v4.1.stable
v4.0.stable
v4.0.beta.10
### System information
Godot v4.3.rc1 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.5186) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 Threads)
### Issue description
`CharcterBody2D` with velocity of (0, 0) sticks to other `CharacterBody2D` which collided with it.
`CollisionShape2D.shape` doesn't matter.
`motion_mode` doesn't matter.
`platform_on_leave` doesn't matter.
Static CharacterBody2D receives slide_collisions without moving and receives them while stuck to other body.
Requires minimal code to test. For MRP I used AnimationPlayer for `dir` manipulation.
```gdscript
extends CharacterBody2D
@export var speed_max:float = 60.0
@export var dir:Vector2
func _physics_process(delta: float) -> void:
velocity = velocity.move_toward(speed_max * dir, delta * 200.0)
move_and_slide()
```
https://github.com/user-attachments/assets/f58e10ae-863a-4ddf-ae01-f62fcc6fd329
### Steps to reproduce
- CharacterBody2D without velocity calling move_and_slide()
- Second CharacterBody2D running into it and walking away
### Minimal reproduction project (MRP)
[sticky_collision.zip](https://github.com/user-attachments/files/16418895/sticky_collision.zip)
Contributor guide
Research direction
Start by running the linked sticky_collision.zip minimal reproduction and inspect the supplied CharacterBody2D script, especially the call to move_and_slide() with zero velocity. Reproduce the collision sequence described in the steps, then verify that a stationary body no longer sticks to another CharacterBody2D or receives slide collisions while stuck.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100