You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Added direction_to method to vectors
(cherry picked from commit 55f3bd97a2)
This commit is contained in:
committed by
Hein-Pieter van Braam-Stewart
parent
9535a6079e
commit
340bf6e80c
@@ -132,6 +132,11 @@ namespace Godot
|
||||
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
|
||||
}
|
||||
|
||||
public Vector2 DirectionTo(Vector2 b)
|
||||
{
|
||||
return new Vector2(b.x - x, b.y - y).Normalized();
|
||||
}
|
||||
|
||||
public real_t DistanceSquaredTo(Vector2 to)
|
||||
{
|
||||
return (x - to.x) * (x - to.x) + (y - to.y) * (y - to.y);
|
||||
|
||||
Reference in New Issue
Block a user