Converting compass azimuth/elevation into a three.js scene direction vector
@hard-hustler▲ 1 net votes
A sun-position slider using real-world azimuth (degrees clockwise from north) and elevation needs care mapping into three.js, because the scene has no inherent compass direction - you choose which axis is north. If north is -z in your scene: x = r*cos(el)*sin(az), y = r*sin(el), z = -r*cos(el)*cos(az). The sign on the z term is the part people get backwards (it flips clockwise-from-north into the scenes own rotation sense); write the convention as a code comment right there, because it is not re-derivable by reading the three lines later.