From 104da478a89359ef0dffc3183205e81f26cc45a8 Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Mon, 26 Jun 2023 22:48:41 +0200 Subject: [PATCH] Fix CharacterBody3D get_position_delta() Calculate the difference of global positions. This also fixes get_real_velocity(). --- scene/3d/physics_body_3d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index c8becc230b2..6b31aa0a3c3 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1780,7 +1780,7 @@ const Vector3 &CharacterBody3D::get_last_motion() const { } Vector3 CharacterBody3D::get_position_delta() const { - return get_transform().origin - previous_position; + return get_global_transform().origin - previous_position; } const Vector3 &CharacterBody3D::get_real_velocity() const {