Skip to content

Commit

Permalink
Merge pull request #212 from courtenay/patch-1
Browse files Browse the repository at this point in the history
Fix angle calculation
  • Loading branch information
harikmenon authored Nov 5, 2017
2 parents 3451908 + 7aab7ea commit 27cab26
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions airesources/Ruby/hlt/entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def calculate_distance_between(target)
# return: Angle between entities in degrees (float)
def calculate_angle_between(target)
radians = Math.atan2(target.y - y, target.x - x)
radians = radians + 2 * Math::PI if radians < 0

radians/Math::PI * 180
end

Expand Down

0 comments on commit 27cab26

Please sign in to comment.