Godot Version
4.6
Question
When I press WASD some Error occurs !
https://vimeo.com/1158815860?fl=ip&fe=ec
This is the script ;
extends CharacterBody3D
const SPEED = 10
func _ready(): #cursor capture
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
# PROBLEM AT (5,1),(6,7) AND UPPER MID
func _unhandled_input(event):
if event is InputEventMouseMotion:
rotation.y -= event.screen_relative.x * 0.001
%Camera3D.rotation_degrees.x -= event.screen_relative.y * 0.1
%Camera3D.rotation_degrees.x = clamp(
%Camera3D.rotation_degrees.x, -60, 60
)
elif event.is_action_pressed("ui_cancel"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
elif event.is_action_pressed("ui_accept"):
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _physics_process(delta):
if Input.is_action_pressed("move_forward"):
position.z += transform.basis.z * SPEED * delta
elif Input.is_action_pressed("move_back"):
position.z -= transform.basis.z * SPEED * delta
elif Input.is_action_pressed("move_right"):
position.x -= transform.basis.x * SPEED * delta
elif Input.is_action_pressed("move_left"):
position.x += transform.basis.z * SPEED * delta
