Ajout de textures proto et control de souris.
This commit is contained in:
14
Player.gd
Normal file
14
Player.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends KinematicBody
|
||||
|
||||
var mouse_sensitivity = 0.03
|
||||
|
||||
onready var head = $Head
|
||||
|
||||
func _ready():
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseMotion:
|
||||
rotate_y(deg2rad(-event.relative.x * mouse_sensitivity))
|
||||
head.rotate_x(deg2rad(-event.relative.y * mouse_sensitivity))
|
||||
head.rotation.x = clamp(head.rotation.x, deg2rad(-89), deg2rad(89))
|
||||
Reference in New Issue
Block a user