]> Untitled Git - star-foxy.git/commitdiff
Fixed air friction
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Mon, 15 Nov 2021 00:01:52 +0000 (18:01 -0600)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Mon, 15 Nov 2021 00:01:52 +0000 (18:01 -0600)
player/player.gd

index b8d2b3b3b1f16fbe6da8aeba46b9108ec045430d..fa2445ffe0e2a39f195475cd12acb3bcc89a517d 100644 (file)
@@ -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)