Import_3ds: Fixed target calculation #104748

Closed
Sebastian Sille wants to merge 1 commits from import_3ds-fix_target_calculation into blender-v3.6-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

View File

@ -577,6 +577,9 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI
else: else:
tilt = -1 * (math.copysign(pitch, pos[0])) tilt = -1 * (math.copysign(pitch, pos[0]))
pan = -1 * (math.radians(90) - math.atan(pos[1] / foc)) 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]): 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]) 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]) 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: else:
tilt = -1 * (math.copysign(pitch, pos[1])) tilt = -1 * (math.copysign(pitch, pos[1]))
pan = -1 * (math.radians(90) - math.acos(pos[0] / foc)) 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 direction = tilt, pan
return direction return direction