extends Node
onready var meshNode : Spatial = get_node("../Mesh")
onready var thirdPersonclippedCamera : Spatial = get_node("../Mesh/Camroot/h/v/Camera")
onready var thirdPersonclippedCameraH : Spatial = get_node("../Mesh/Camroot/h")
onready var thirdPersonclippedCameraHV : Spatial = get_node("../Mesh/Camroot/h/v")
export var movementDirection : Vector3 = Vector3.ZERO
signal player_restore_origin()
signal player_mousemotion_event(event)
signal player_action_roll()
signal player_move(direction)
func _ready():
#thirdPersonclippedCameraHV = thirdPersonclippedCameraH.find_node("v")
# thirdPersonclippedCameraHV = ClippedCamera.get_node("v")
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
thirdPersonclippedCamera.add_exception(get_parent())
func _process(_delta):
movementDirection = Vector3(Input.get_action_strength("left") - Input.get_action_strength("right"),
0,
Input.get_action_strength("forward") - Input.get_action_strength("backward"))
emit_signal("player_move", movementDirection)
pass
func _physics_process(_delta):
pass
func _input(event : InputEvent):
if event is InputEventMouseMotion:
emit_signal("player_mousemotion_event", event)
if event.is_action_pressed("roll"):
emit_signal("player_action_roll")
if Input.is_action_just_pressed("restoreOrigin"):
emit_signal("player_restore_origin")
#if Input.is_action_pressed("forward") || Input.is_action_pressed("backward") || Input.is_action_pressed("left") || Input.is_action_pressed("right"):
#movementDirection = Vector3.BACK
#movementDirection = Vector3(Input.get_action_strength("left") - Input.get_action_strength("right"),
# 0,
# Input.get_action_strength("forward") - Input.get_action_strength("backward"))
#emit_signal("player_move", movementDirection)