Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ZerryTadams |
For reference, using this tutorial: https://www.youtube.com/watch?v=_55ktNdarxY
I’m uncertain how to proceed. Once I hit F5 to play, the window doesn’t detect any inputs, either from keyboard (keys assigned in project settings) or mouse movement.
extends KinematicBody
onready var camera = $Pivot/Camera
var gravity = -30
var max_speed = 8
var mouse_sensitivity = 0.002
var velocity = Vector3()
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _input(event):
if event.is_action_pressed(“ui_cancel”):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if event.is_action_pressed(“click”):
if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
get_tree().set_input_as_handled()
func get_input():
var input_dir = Vector3()
# desired move in camera direction
if Input.is_action_pressed(“move_forward”):
input_dir += -global_transform.basis.z
if Input.is_action_pressed(“move_back”):
input_dir += global_transform.basis.z
if Input.is_action_pressed(“strafe_left”):
input_dir += -global_transform.basis.x
if Input.is_action_pressed(“strafe_right”):
input_dir += global_transform.basis.x
input_dir = input_dir.normalized()
return input_dir
func _unhandled_input(event):
if event is InputEventMouseMotion:
rotate_y(-event.relative.x * mouse_sensitivity)
$Pivot.rotate_x(-event.relative.y * mouse_sensitivity)
if event.is_action_pressed(“ui_cancel”):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
Any advice on how to proceed?
Just tested the camera scene, which I can move. However, I cannot move it or the player character in the scene which combines them
ZerryTadams | 2022-08-10 00:30