Skip to content

Commit

Permalink
fix: make 2d example boid sprite direction accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
yusdacra committed Dec 6, 2024
1 parent b30b0ef commit d33d4e9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/boids/2d/example_boid.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ script/source = "extends Sprite2D
@onready var boid: Boid2D = get_parent()

func _process(delta: float) -> void:
var dir := boid.get_velocity().normalized()
var target_rot := atan2(dir.y, dir.x)
rotation = move_toward(rotation, target_rot, delta * PI * 2.0 * absf(target_rot - rotation))
var dir_target := boid.global_position + boid.get_velocity()
look_at(dir_target)
"

[node name="ExampleBoid" type="Boid2D"]
Expand Down

0 comments on commit d33d4e9

Please sign in to comment.