From 0f518727c28d3204415db14c7ca0e4f7cb653677 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Thu, 9 Dec 2021 00:52:59 +0100 Subject: working --- scripts/utils.gd | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 scripts/utils.gd (limited to 'scripts/utils.gd') diff --git a/scripts/utils.gd b/scripts/utils.gd new file mode 100644 index 0000000..a0ecae4 --- /dev/null +++ b/scripts/utils.gd @@ -0,0 +1,10 @@ +class_name Utils +extends Object + +static func quat_look (target, up): + var dot = target.dot(up) + var angle = acos(dot) + var axis = up.cross(target).normalized() + if angle == 0: axis = up + if angle == PI: axis = Vector3.RIGHT + return Quat(axis, angle) -- cgit v1.2.3-54-g00ecf