updates. herorganizatie en schilderij
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
extends CharacterBody3D
|
||||
|
||||
|
||||
const WALK_SPEED = 5.0
|
||||
const MOUSE_SENS = 0.002
|
||||
|
||||
var mouse_mode = 2
|
||||
|
||||
func _ready():
|
||||
Input.set_mouse_mode(mouse_mode)
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseMotion and mouse_mode == 2:
|
||||
$Pivot.rotate_y(-event.relative.x*MOUSE_SENS)
|
||||
$Pivot/Camera.rotate_x(-event.relative.y*MOUSE_SENS)
|
||||
elif event.is_action_pressed("mode"):
|
||||
mouse_mode = mouse_mode ^ 1
|
||||
Input.set_mouse_mode(mouse_mode)
|
||||
|
||||
func _physics_process(delta):
|
||||
if mouse_mode == 2:
|
||||
var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||
var direction = ($Pivot.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
velocity.x = direction.x * WALK_SPEED
|
||||
velocity.z = direction.z * WALK_SPEED
|
||||
move_and_slide()
|
||||
Reference in New Issue
Block a user