godotengine / godotengine/godot

CharacterBody3D collision lagging behind it's visual representation.

Open
#93,522 0 comments 0 reactions 0 assignees View on GitHub
discussion topic:3d topic:physics usability
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: 4.0 stable, 4.2.2 stable, 4.3 beta 2. Maybe 3.X as well, didn't test yet.

### System information

Windows 10, Mobile renderer, GPU: RX 7800 XT

### Issue description

When a CharacterBody3D is moving at any speed, it's collision starts "lagging" behind its visual representation (even visible collision shapes are ahead of the true collisions), the faster the body is moving, the larger the offset.
In my case I want the player to be able to move on top of a vehicle.
This happens when moving the "vehicle" both like this:
```gdscript
speed = min(speed + 2.0 * delta, 30.0)
velocity = Vector3(speed,0,0)
move_and_slide()
```
and like this:
```gdscript
speed = min(speed + 2.0 * delta, 30.0)
global_position.x += speed * delta
```

It also might be happening to all 3D collisions, but I couldn't reliably test it with rigid bodies.

### Steps to reproduce

Move a CharacterBody3D at a reasonable speed and make it interact with another CharacterBody3D. Have debug collision shapes on, you'll notice the collisions don't match the shapes.

### Minimal reproduction project (MRP)

[CollisionBugTest.zip](https://github.com/user-attachments/files/15945893/CollisionBugTest.zip)

Contributor guide

Open the contributing guide

Research direction

Start by running the attached CollisionBugTest.zip reproduction with debug collision shapes enabled, then compare CharacterBody3D behavior when moved with move_and_slide() and with global_position.x. Confirm the offset across the listed Godot versions and determine whether it also affects other 3D collision bodies; done means the collision representation matches the visual body while moving.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.