Added controller activation signal
This commit is contained in:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user