Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | owais91 |
Hello, I am new to Godot3D and trying to follow the tutorial here:
extends KinematicBody
export var _mouse_sensitivity: float = 0.20
func _ready() -> void:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _input(event) -> void:
aim(event)
func _physics_process(delta):
var movement_vector: Vector3
if Input.is_action_pressed("move_forward"):
movement_vector = Vector3(0, 0, 1)
move_and_slide(movement_vector)
func aim(event: InputEvent) -> void:
var mouse_motion = event as InputEventMouseMotion
if mouse_motion:
self.rotation_degrees.y -= mouse_motion.relative.x*_mouse_sensitivity
var current_tilt: float = $Camera.rotation_degrees.x
current_tilt -= mouse_motion.relative.y*_mouse_sensitivity
$Camera.rotation_degrees.x = clamp(current_tilt, -180, 0)
This issue doesn’t occur if I comment out the y-axis rotation or move_and_slide. I’ve tried locking the fps and disabling vsync, but looks like something else is the issue. Any help would be appreciated!