From 7b71894a16da24c2305634871d63d4aedbcddcff Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 3 Oct 2023 19:26:49 -0400 Subject: [PATCH] Move ball to render tick for smoothness --- Player.gd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Player.gd b/Player.gd index 0e1efb0..abdf836 100644 --- a/Player.gd +++ b/Player.gd @@ -34,6 +34,11 @@ func _ready(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) +func _process(delta): + # Do this on the render tick so it doesnt jitter at higher FPS + _ball.global_position = _camera.global_position - _camera.global_transform.basis.z * 2.0 + + func _physics_process(delta): # Shamelessly stolen code from quake :) @@ -89,8 +94,6 @@ func _physics_process(delta): velocity = vel move_and_slide() - _ball.global_position = _camera.global_position - _camera.global_transform.basis.z * 2.0 - func _apply_friction(vel: Vector3, delta: float): var speed = sqrt(vel.x ** 2 + vel.z ** 2) if(speed == 0.0): return vel