How to convert quaternions from three.js system to Blender system?

blender

#1

Hello,

Three.js uses a standard system of axes (Y is up), whereas Blender has its own vision with all axes mixedup. I would like to export my object from three.js, import it in Blender and rotate it according to quaternions data taken from three.js. Taking into account that systems of axes in these two “applications” are different, I can’t use pure quaternions data from three.js.

Is there any rules for converting quaternions data from three.js system to Blender system (e.g. “Y in three.js -> Z in Blender”)?


#2

What 3D format yo do want to use? Sometimes importers (and exporters) provide axes conversion features so you don’t have to deal with it.

BTW: It’s a bit unusual to say “convert quaternions”. What you actually convert is the coordinate system.


#3

I figured out that these commands do the trick:

var quaternion = new THREE.Quaternion();
quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );

.multiply ( q : Quaternion ) : Quaternion
Multiplies this quaternion by q.