Skip to content

Commit

Permalink
Added V2Utils.is_clockwise().
Browse files Browse the repository at this point in the history
  • Loading branch information
addmix committed Feb 6, 2024
1 parent b94b8d9 commit 6ad6e5d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions globals/vector2_utils.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ static func distance_manhattan(a : Vector2, b : Vector2) -> float:
static func distance_chebyshev(a : Vector2, b : Vector2) -> float:
return max(abs(a.x - b.x), abs(a.y - b.y))

static func is_clockwise(a : Vector2, b : Vector2, c : Vector2) -> bool:
return (a - b).cross(a - c) > 0

static func move_toward(position : Vector2, target : Vector2, delta : float = 1.0) -> Vector2:
var direction : Vector2 = target - position
var distance_squared : float = direction.length_squared()
Expand Down

0 comments on commit 6ad6e5d

Please sign in to comment.