forked from funnymemellama/funnymemellama
Move ball to render tick for smoothness
This commit is contained in:
parent
33ba20a9a1
commit
7b71894a16
1 changed files with 5 additions and 2 deletions
|
@ -34,6 +34,11 @@ func _ready():
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
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):
|
func _physics_process(delta):
|
||||||
# Shamelessly stolen code from quake :)
|
# Shamelessly stolen code from quake :)
|
||||||
|
|
||||||
|
@ -89,8 +94,6 @@ func _physics_process(delta):
|
||||||
velocity = vel
|
velocity = vel
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
_ball.global_position = _camera.global_position - _camera.global_transform.basis.z * 2.0
|
|
||||||
|
|
||||||
func _apply_friction(vel: Vector3, delta: float):
|
func _apply_friction(vel: Vector3, delta: float):
|
||||||
var speed = sqrt(vel.x ** 2 + vel.z ** 2)
|
var speed = sqrt(vel.x ** 2 + vel.z ** 2)
|
||||||
if(speed == 0.0): return vel
|
if(speed == 0.0): return vel
|
||||||
|
|
Loading…
Reference in a new issue