From fe79d1bd47fbbd189139b665ae1ae0edcfd658e2 Mon Sep 17 00:00:00 2001 From: Sebastian Sille Date: Tue, 11 Jul 2023 13:01:13 +0200 Subject: [PATCH] Import_3ds: Fixed target calculation If the absolute location is smaller than the target, the axes have to be inverted --- io_scene_3ds/import_3ds.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py index 459c743d0..e61227947 100644 --- a/io_scene_3ds/import_3ds.py +++ b/io_scene_3ds/import_3ds.py @@ -577,6 +577,9 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI else: tilt = -1 * (math.copysign(pitch, pos[0])) pan = -1 * (math.radians(90) - math.atan(pos[1] / foc)) + if abs(location[1]) < abs(target[1]): + tilt = -1 * tilt + pan = -1 * pan elif abs(location[1] - target[1]) > abs(location[0] - target[0]): foc = math.copysign(math.sqrt(pow(pos[1],2) + pow(pos[0],2)), pos[1]) dia = math.copysign(math.sqrt(pow(foc,2) + pow(target[2],2)), pos[1]) @@ -587,6 +590,9 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI else: tilt = -1 * (math.copysign(pitch, pos[1])) pan = -1 * (math.radians(90) - math.acos(pos[0] / foc)) + if abs(location[0]) < abs(target[0]): + tilt = -1 * tilt + pan = -1 * pan direction = tilt, pan return direction -- 2.30.2