From: Clifton Palmer Date: Mon, 15 Nov 2021 00:01:52 +0000 (-0600) Subject: Fixed air friction X-Git-Url: http://git.purplebirdman.com/star-foxy.git/commitdiff_plain/30cc1662f898e7b25cfe989eb74cdaa5576ec4c2?ds=sidebyside Fixed air friction --- diff --git a/player/player.gd b/player/player.gd index b8d2b3b..fa2445f 100644 --- a/player/player.gd +++ b/player/player.gd @@ -1,9 +1,9 @@ extends KinematicBody -const SPEED_FORWARD = 2 +const SPEED_FORWARD = 20 +const SPEED_MAX = 20 const SPEED_TURN = 120 const SPEED_AIM = PI / 2 -const FRICTION = 0.95 var velocity = Vector3() @@ -44,6 +44,10 @@ func _process(delta): # move foward according to the camera's POV var vec_forward = transform.basis.z velocity += SPEED_FORWARD * -vec_forward * delta + + # air friction + var friction = SPEED_MAX / velocity.length() + velocity *= friction func _physics_process(_delta): velocity = move_and_slide(velocity, Vector3.UP)