From 55f3bd97a270b691c26d6eda70bc7c0a3ec8f4e8 Mon Sep 17 00:00:00 2001 From: Chaosus Date: Wed, 27 Mar 2019 13:51:05 +0300 Subject: Added direction_to method to vectors --- modules/mono/glue/Managed/Files/Vector3.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/mono/glue/Managed/Files/Vector3.cs') diff --git a/modules/mono/glue/Managed/Files/Vector3.cs b/modules/mono/glue/Managed/Files/Vector3.cs index f6ff27989d..0c96d346a9 100644 --- a/modules/mono/glue/Managed/Files/Vector3.cs +++ b/modules/mono/glue/Managed/Files/Vector3.cs @@ -126,6 +126,11 @@ namespace Godot ); } + public Vector3 DirectionTo(Vector3 b) + { + return new Vector3(b.x - x, b.y - y, b.z - z).Normalized(); + } + public real_t DistanceSquaredTo(Vector3 b) { return (b - this).LengthSquared(); -- cgit v1.2.3