From 0254a8b5bf79706f7110a5cabe7c36237e36247f Mon Sep 17 00:00:00 2001 From: unfa Date: Sun, 14 Jun 2020 01:37:44 +0200 Subject: [PATCH] Movement not glitching out --- Player.gd | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Player.gd b/Player.gd index 614424c..bbdb686 100644 --- a/Player.gd +++ b/Player.gd @@ -2,7 +2,7 @@ extends KinematicBody const GRAVITY = 9.8 const JUMP_VELOCITY = 400 -const WALK_VELOCITY = 150 +const WALK_VELOCITY = 550 var velocity = Vector3.ZERO @@ -16,10 +16,13 @@ func gravity(): self.velocity.y -= GRAVITY func walk(): - walkDirection = walkDirection.normalized() - print("Player walkDirection: ", walkDirection) + var walkDirectionNormalized = walkDirection.normalized() + print("Player walkDirection: ", walkDirectionNormalized) - #velocity.xz = WALK_VELOCITY * walkDirection + var walkVelocity = WALK_VELOCITY * walkDirectionNormalized + + velocity.x = walkVelocity.y + velocity.z = - walkVelocity.x remote func jump(): print("JUMP")