How to Convert Euler to Quaternion in Blender

Converting Euler animation tracks to quaternion curves in Blender is an essential technique for eliminating gimbal lock and achieving smooth rotational interpolations across complex animations. This guide covers the straightforward process of switching rotation modes and baking Euler keyframes into quaternion (WXYZ) curves for both individual objects and armature bones directly within Blender.

Step 1: Change the Rotation Mode

  1. Select the object or armature bone containing the Euler animation curves.
  2. Open the Sidebar in the 3D Viewport by pressing N, or navigate to the Object Properties panel (or Bone Properties panel if using an armature).
  3. Locate the Transform section and find the Rotation dropdown menu.
  4. Change the current Euler mode (such as XYZ Euler) to Quaternion (WXYZ).

Step 2: Bake the Animation to Quaternion Curves

Simply switching the mode changes how Blender calculates future rotations, but existing animation channels must be baked to generate the new four-component quaternion curves.

  1. Ensure your object is selected in Object Mode (or select all relevant bones in Pose Mode).
  2. Open the search menu by pressing F3 (or spacebar, depending on your keymap), type Bake Action, and press Enter.
    • Alternatively, go to the top menu: Object > Animation > Bake Action... (or Pose > Animation > Bake Action... for bones).
  3. In the Bake Action dialog box, configure the following settings:
    • Start Frame / End Frame: Set to match the range of your animation.
    • Frame Step: Set to 1 for full precision (or higher if keyframe reduction is desired).
    • Only Selected: Checked.
    • Visual Keying: Checked.
    • Bake Data: Choose Object or Pose depending on what you are converting.
  4. Click OK to execute the bake.

Step 3: Clean Up Unused Euler Channels

  1. Open the Graph Editor or Dope Sheet.
  2. Locate any remaining unused Euler channels (X, Y, Z Rotation) that were not automatically overwritten.
  3. Select the unused channels and press Delete or X to remove them, leaving only the newly generated Quaternion (W, X, Y, Z) tracks.

Converting via Python (Batch Method)

If you need to convert multiple objects quickly without manual baking menus, run this script in Blender's Text Editor:

import bpy

# Set the active frame range
start_frame = bpy.context.scene.frame_start
end_frame = bpy.context.scene.frame_end

# Switch selected objects to Quaternion and bake
for obj in bpy.context.selected_objects:
    obj.rotation_mode = 'QUATERNION'

bpy.ops.nla.bake(
    frame_start=start_frame,
    frame_end=end_frame,
    only_selected=True,
    visual_keying=True,
    bake_types={'OBJECT'}
)

After running the operation, inspect the animation curves in the Graph Editor to confirm that the four quaternion rotation curves (W, X, Y, Z) are actively driving the rotation.