### Godot version

v4.0.3.stable.official [5222a99f5]

### System information

Windows 10

### Issue description

If a `CharacterBody3D`'s parent node is in a position other than the origin, the difference will be included in its `get_position_delta()` value, and therefore also `get_real_velocity()`. This is because [the implementation](https://github.com/godotengine/godot/blob/3710f069293f2fde8afe33fea898c4b36fa5e943/scene/3d/physics_body_3d.cpp#L1782-L1784) subtracts the current **local** transform from the old **global** transform. I don't know if behaviour in this case is defined at all, but I would expect it to be consistent with everything else in the `CharacterBody3D` context, such that if `velocity` is zero, `get_position_delta()` is also zero. The same applies to `CharacterBody2D`.

### Steps to reproduce

1. Create a `Node3D` with a `CharacterBody3D` in it
2. Move the `Node3D`
3. Call `move_and_slide()` in the `CharacterBody3D` and observe `get_position_delta()`

### Minimal reproduction project

[godot cb3d.zip](https://github.com/godotengine/godot/files/11861307/godot.cb3d.zip)

if (p_was_on_floor && !vel_dir_facing_up) {
							
							Transform3D gt = get_global_transform();
							real_t travel_total = result.travel.length();
							real_t cancel_dist_max = MIN(0.1, margin * 20);
							if (travel_total <= margin + CMP_EPSILON) {
								gt.origin -= result.travel;
								result.travel = Vector3(); 
							} else if (travel_total < cancel_dist_max) { 
								gt.origin -= result.travel.slide(up_direction);
								
								motion = motion.slide(up_direction);
								result.travel = Vector3();
							} else {
								
								result.travel = result.travel.slide(up_direction);
								motion = motion.normalized() * result.travel.length();
							}
							set_global_transform(gt);
							
							_snap_on_floor(true, false);
						} else {
							
							motion = result.remainder;
						}
						
						Vector3 forward = wall_normal.slide(up_direction).normalized();
						motion = motion.slide(forward);
						
						if (vel_dir_facing_up) {