Skip to content
Snippets Groups Projects
Commit 22214fda authored by Julien Duroure's avatar Julien Duroure
Browse files

glTF importer: Fix some antipodal issue in bone rotation

parent 787a1b8f
No related branches found
No related tags found
No related merge requests found
...@@ -100,12 +100,20 @@ class BlenderBoneAnim(): ...@@ -100,12 +100,20 @@ class BlenderBoneAnim():
if animation.samplers[channel.sampler].interpolation == "CUBICSPLINE": if animation.samplers[channel.sampler].interpolation == "CUBICSPLINE":
# TODO manage tangent? # TODO manage tangent?
quat_keyframes = ( quat_keyframes = [
quaternion_gltf_to_blender(values[idx * 3 + 1]) quaternion_gltf_to_blender(values[idx * 3 + 1])
for idx in range(0, len(keys)) for idx in range(0, len(keys))
) ]
else: else:
quat_keyframes = (quaternion_gltf_to_blender(vals) for vals in values) quat_keyframes = [quaternion_gltf_to_blender(vals) for vals in values]
# Manage antipodal quaternions
# (but is not suffisant, we also convert quaternion --> euler --> quaternion)
for i in range(1, len(quat_keyframes)):
if quat_keyframes[i].dot(quat_keyframes[i-1]) < 0:
quat_keyframes[i] = -quat_keyframes[i]
if not node.parent: if not node.parent:
final_rots = [ final_rots = [
bind_rotation.inverted() @ quat_keyframe bind_rotation.inverted() @ quat_keyframe
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment