Quaternion rotation from angle

Hey, im rotating an object3d as follows

this.ctrl.rotation = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI)
this.obj.setRotationFromQuaternion(this.ctrl.rotation)

and the rotation i get is Quaternion {_x: -0, _y: -1, _z: -0, _w: 6.123233995736766e-17}

How can I avoid these science notations 6.123233995736766e-17?

jsFiddle here <—

You might want to round the values. See my Robot Simulation / Rotation issues with the link to the project. In https://github.com/BITPlan/PI-Q-Robot/blob/c8d4ff619ace81da2e5ef414292a66cb9ee07388/web/js/three_basics.js you’ll find the class SceneDebug which uses class Debug and there is a function format that displays the values in a rounded form. If you need to change them use Math.round() or Math.floor(),

Why is this a problem for you?

1 Like