add format and comments
This commit is contained in:
@@ -81,6 +81,7 @@ func _notification(what: int) -> void:
|
|||||||
window_out_of_focus = true
|
window_out_of_focus = true
|
||||||
|
|
||||||
|
|
||||||
|
## Start gradually moving camera towards a position
|
||||||
func head_to(to: Vector3, zoom: float = ZOOM_VALUE_DEFAULT) -> void:
|
func head_to(to: Vector3, zoom: float = ZOOM_VALUE_DEFAULT) -> void:
|
||||||
heading_to_position = to
|
heading_to_position = to
|
||||||
heading_from_position = target_position
|
heading_from_position = target_position
|
||||||
|
|||||||
@@ -73,7 +73,11 @@ func _animate(delta: float) -> void:
|
|||||||
if velocity.length() > 0.1:
|
if velocity.length() > 0.1:
|
||||||
var velocity_normalized := velocity.normalized()
|
var velocity_normalized := velocity.normalized()
|
||||||
var angle := atan2(-velocity_normalized.x, -velocity_normalized.z) + PI
|
var angle := atan2(-velocity_normalized.x, -velocity_normalized.z) + PI
|
||||||
global_rotation.y = rotate_toward(global_rotation.y, angle, TURN_SPEED * delta)
|
global_rotation.y = rotate_toward(
|
||||||
|
global_rotation.y,
|
||||||
|
angle,
|
||||||
|
TURN_SPEED * delta,
|
||||||
|
)
|
||||||
# look_at(global_position + velocity, Vector3.UP, true)
|
# look_at(global_position + velocity, Vector3.UP, true)
|
||||||
animation_player.play('walk')
|
animation_player.play('walk')
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user