I'm experimenting with WebGL and Three.js, But how to calculate the Z-Axis coordination while moving mouse?
I use this for X and Y:
function getCoord(e) {
X = e.layerX - canvas.offsetLeft;
Y = e.layerY - canvas.offsetTop;
}
how to get Z coordination?
Edit: I find this example, but can't figure it out myself... https://github.com/mrdoob/three.js/blob/master/examples/webgl_interactive_voxelpainter.html
Thanks