Godot 3d jump not working

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

So im working on my first 3d game in godot and am currently running into a problem. im trying jump but its not working any idea why?

extends KinematicBody
export (int) var speed = 500
var Input3d = Vector3.ZERO
export (int) var gravity = 20
export (int) var jumpforce = 300

func _physics_process(delta):

func gravity1(delta):
    if is_on_floor():
	    Input3d.y = 0
	    if Input.is_action_just_pressed("space"):
		    Input3d.y = -jumpforce
    Input3d.y -= gravity * delta


func movementloop(delta):
Input3d.x = Input.get_action_strength("ui_right") - 
    Input3d.z = Input.get_action_strength("ui_down") - 
    Input3d.x = Input3d.x * speed * delta
    Input3d.z = Input3d.z * speed * delta
    Input3d = move_and_slide(Input3d, Vector3.UP)
:bust_in_silhouette: Reply From: Magso

It will be better to create a separate jump variable as normalized() will cause it to jump less when moving because normalized() is Vector3 / Vector3.Length(), Length() returns the distance of the Vector3 from the origin. So take 0, 1, 1 the Length is roughly 1.4 and the result will end up being 0, 0.7, 0.7.

AlsoInput3d.y = -jumpforce should be Input3d.y = jumpforce.