godotengine / godotengine/godot

CharacterBody3D lags behind when moving on AnimatableBody3D moved by code

Open
#101,253 4 comments 4 reactions 0 assignees View on GitHub
bug confirmed topic:3d topic:physics
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Tested in 4.3.stable

### System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 32.0.15.6094) - Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 Threads)

### Issue description

When using a CharacterBody3D on an AnimatableBody3D and moving the latter via code, the character ends up lagging behind by one frame.

https://github.com/user-attachments/assets/22de841d-9966-46e0-ad9e-f4b794164556

(Not that for this I tried a variety of setup for the moving platform that in my real project is supposed to be a moving vehicle that the player can move onto and wanted to have two characterbody3D interact with one another, with no success... Maybe another bug or a bad setup from me)

### Steps to reproduce

- Set an AnimatbleBody3D with collider (and mesh for visual help)
- Set a script on it to move it using `move_and_collide`
- Set a CharacterBody3D using the default movement template
- Move the AnimatableBody3D and observe the character lag behind by what looks like one frame
(it works better when attaching a camera to the character)

### Minimal reproduction project (MRP)

[charabodybug.zip](https://github.com/user-attachments/files/18339999/charabodybug.zip)

Contributor guide

Open the contributing guide

Research direction

Start by running the attached charabodybug.zip minimal reproduction project and inspect the CharacterBody3D default movement template alongside the AnimatableBody3D script using move_and_collide. Compare the platform and character movement timing, then verify the completed change removes the apparent one-frame lag while preserving the reproduction setup.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.