diff options
author | jacopograndi <jacopo.grandi@outlook.it> | 2021-12-09 00:52:59 +0100 |
---|---|---|
committer | jacopograndi <jacopo.grandi@outlook.it> | 2021-12-09 00:52:59 +0100 |
commit | 0f518727c28d3204415db14c7ca0e4f7cb653677 (patch) | |
tree | a595121771b69a52f17154d8e5c61b7e4b2b8190 /scripts/utils.gd |
working
Diffstat (limited to 'scripts/utils.gd')
-rw-r--r-- | scripts/utils.gd | 10 |
1 files changed, 10 insertions, 0 deletions
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) |