I'm trying to make a simple 3D character controller but it will only move on the X axis

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Variant606
extends KinematicBody

var vel = Vector3.ZERO

func _ready():
	pass

func _physics_process(delta):
	if Input.is_key_pressed(KEY_D):
		vel.x = 5
		
	if Input.is_key_pressed(KEY_A):
		vel.x = -5
	
	if Input.is_key_pressed(KEY_W):
		vel.z = 5
		
	if Input.is_key_pressed(KEY_S):
		vel.z = -5
	
	

	if Input.is_key_pressed(KEY_D) == false and Input.is_key_pressed(KEY_A) == false:
		vel.x = 0
		
	if Input.is_key_pressed(KEY_W) == false and Input.is_key_pressed(KEY_S) == false:
		vel.z = 0
	
	print(vel)
	move_and_slide(vel)

Edited to fix code formatting…

jgodfrey | 2023-02-11 18:03