How would I rotate in the direction I am facing?

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

I am new to godot and I love it so far but I am stuck. Code:

    extends KinematicBody

    onready var cam = get_node("Camera")

    var sens = 0.2

    var velocity = Vector3()
    const SPEED = 5

    func _ready():

    func _input(event):
        if event is InputEventMouseMotion:
	        var movement = event.relative
	        cam.rotation.x += -deg2rad(movement.y * sens)
	        rotation.y += -deg2rad(movement.x * sens)

    func _physics_process(delta):
        if Input.is_key_pressed(KEY_ESCAPE):

        if Input.is_action_pressed("ui_left") and Input.is_action_pressed("ui_right"):
	        velocity.z = 0
        elif Input.is_action_pressed("ui_left"):
	        velocity.z = -SPEED
        elif Input.is_action_pressed("ui_right"):
	        velocity.z = SPEED
	        lerp(velocity.z, 0, 0.1)
	        velocity.z = 0
       if Input.is_action_pressed("ui_up") and Input.is_action_pressed("ui_down"):
	       velocity.x = 0
       elif Input.is_action_pressed("ui_up"):
	       velocity.x = SPEED
       elif Input.is_action_pressed("ui_down"):
	       lvelocity.x = -SPEED
	        lerp(velocity.x, 0, 0.1)
	        velocity.x = 0
:bust_in_silhouette: Reply From: textrivers

This video tutorial might help. The Godot FPS tutorial also might help.

Thanks alot!

Annoying_Brother | 2020-12-11 18:48