[SOLVED] Rotating with quaternion axis angle distorts object

I’m trying to animate the rotation of a cube around an axis using cube.quaternion.setFromAxisAngle(axis, angle) while incrementing the angle, and it appears to stretch the cube. Here’s a fiddle:

http://jsfiddle.net/trusktr/pwjht246/9/

Is this expected behavior?

adding axis.normalize() before cube.quaternion.setFromAxisAngle() seems to do the trick

1 Like

From the doc about .setFromAxisAngle():
Axis is assumed to be normalized, angle is in radians.

For simplicity you can do even this:
var axis = new THREE.Vector3(1, 1, 1).normalize();

1 Like

@byun @prisoner849 Ah! Thanks! That worked. I missed that part.

Seems it would be more intuitive if we could just pass in any axis. I guess if it supported that then it would have to perform normalization every time, thus negative impact on performance? Maybe if Vector3 had a normalized boolean, then Quaternion could skip normalizing it.