Added controller activation signal

This commit is contained in:
2024-02-24 15:30:41 +01:00
parent 3ba39992bc
commit d1b46fb9e0
10 changed files with 42 additions and 24 deletions

View File

@ -9,11 +9,14 @@ var angle: float
func _ready():
assert(root, "Rotation root needs to be set")
owner.controller.direction_changed.connect(on_direction_changed)
(owner as Character).controlled.connect(on_controlled)
func _process(delta):
root.rotation.y = Math.damp_angle(root.rotation.y, angle, rotation_speed * delta)
func on_controlled(controller: Controller):
controller.direction_changed.connect(on_direction_changed)
func on_direction_changed(new_direction: Vector3):
direction = new_direction