Update direction comparison

Co-authored-by: arnfranke@yahoo.com
This commit is contained in:
Nathan Lovato
2020-11-27 19:27:47 -06:00
co-authored by
parent a187b11171
commit f68a6a25c5
3 changed files with 6 additions and 6 deletions
@@ -85,7 +85,7 @@ call its ``normalize()`` method.
#func _physics_process(delta):
#...
if direction.length() > 0:
if direction != Vector3.ZERO:
direction = direction.normalized()
$Pivot.look_at(translation + direction, Vector3.UP)
@@ -114,7 +114,7 @@ fall speed separately. Be sure to go back one tab so the lines are inside the
func _physics_process(delta):_
#...
if direction.length() > 0:
if direction != Vector3.ZERO:
#...
# Ground velocity
@@ -177,7 +177,7 @@ Here is the complete ``Player.gd`` code for reference.
if Input.is_action_pressed("move_forward"):
direction.z -= 1
if direction.length() > 0:
if direction != Vector3.ZERO:
direction = direction.normalized()
$Pivot.look_at(translation + direction, Vector3.UP)
@@ -212,7 +212,7 @@ Finally, the longest script, ``Player.gd``.
if Input.is_action_pressed("move_forward"):
direction.z -= 1
if direction.length() > 0:
if direction != Vector3.ZERO:
direction = direction.normalized()
$Pivot.look_at(translation + direction, Vector3.UP)
@@ -190,7 +190,7 @@ vector, add the following code.
func _physics_process(delta):
#...
#if direction.length() > 0:
#if direction != Vector3.ZERO:
#...
$AnimationPlayer.playback_speed = 4
else:
@@ -280,7 +280,7 @@ Here's the *Player* script.
if Input.is_action_pressed("move_forward"):
direction.z -= 1
if direction.length() > 0:
if direction != Vector3.ZERO:
direction = direction.normalized()
$Pivot.look_at(translation + direction, Vector3.UP)
$AnimationPlayer.playback_speed = 4