glTF importer: Fix some antipodal issue in bone rotation
This commit is contained in:
parent
787a1b8f1e
commit
22214fda57
|
@ -100,12 +100,20 @@ class BlenderBoneAnim():
|
|||
|
||||
if animation.samplers[channel.sampler].interpolation == "CUBICSPLINE":
|
||||
# TODO manage tangent?
|
||||
quat_keyframes = (
|
||||
quat_keyframes = [
|
||||
quaternion_gltf_to_blender(values[idx * 3 + 1])
|
||||
for idx in range(0, len(keys))
|
||||
)
|
||||
]
|
||||
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:
|
||||
final_rots = [
|
||||
bind_rotation.inverted() @ quat_keyframe
|
||||
|
|
Loading…
Reference in New Issue