Move a Kinematic Object to x and z Cordinates using GDScript in 3D

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

Hello everyone!
I got 2 coordinates from my mouse using get_viewport().get_mouse_position()
Now I want to move one of my kinematic objects to these coordinates.
I think I need just a way to move my kinematic using coordinates cause my object just move weird but see yourself:

extends KinematicBody

var speed = 50
var direction = Vector3()

func _physics_process(delta):
	direction = Vector3(0, 0, 0)
	if Input.is_action_just_pressed("Mouse"):
		direction.x = get_viewport().get_mouse_position().x
		direction.z = 1
		direction.y = get_viewport().get_mouse_position().y
		direction = direction.normalized()
		direction - direction * speed * delta
		move_and_slide(direction, Vector3(0, 1, 0))
:bust_in_silhouette: Reply From: Jakeeee

You may want to check out the docs they have a click and move tutorial.