JSFiddle - React, Tailwind, and code Playground

by Michael Prosser

JavaScript

var halfPI = Math.PI/2;

var direction = { x: 0.5, y: 0.8, z: 0 };

var rotation = { x: direction.z*halfPI, y: (direction.y-1)*halfPI, z: direction.x*halfPI };

console.log(rotation);
console.log((rotation.z*180)/Math.PI);