Skip to content

Commit

Permalink
Merge pull request #945 from AThousandShips/fix_global
Browse files Browse the repository at this point in the history
[Squash The Creeps] Use `Basis.looking_at` to control facing
  • Loading branch information
Calinou authored Sep 9, 2023
2 parents 68aefef + 0938a48 commit 1113baf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 3d/squash_the_creeps/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ func _physics_process(delta):
if direction != Vector3.ZERO:
# In the lines below, we turn the character when moving and make the animation play faster.
direction = direction.normalized()
$Pivot.look_at(position + direction, Vector3.UP)
# Setting the basis property will affect the rotation of the node.
$Pivot.basis = Basis.looking_at(direction)
$AnimationPlayer.speed_scale = 4
else:
$AnimationPlayer.speed_scale = 1
Expand Down

0 comments on commit 1113baf

Please sign in to comment.