I recently discovered that the standard normal vector for geometries in three.js is typically considered to be (0, 0, 1)
.
However, when I tried using the GridHelper constructor, I noticed that it actually creates a plane defined by the X and Z axes, resulting in a normal vector of (0, 1, 0)
.
This discrepancy can be clearly seen in the geometry vertices array of my GridHelper, as shown in this screenshot:
https://i.sstatic.net/P43KA.png
and visually confirmed in this image:
https://i.sstatic.net/nW2IR.png
When I initialize my GridHelper using this code:
var myGridHelper = new THREE.GridHelper(10, 20);
I wonder why GridHelper deviates from the standard normal vector understanding?
Assuming this behavior doesn't change, could I potentially address it by always setting up my GridHelper instances with the following code:
var standardPlaneNormal = new THREE.Vector3(0, 0, 1);
var GridHelperPlaneNormal = new THREE.Vector3(0, 1, 0);
var quaternion = new THREE.Quaternion();
quaternion.setFromUnitVectors(standardPlaneNormal, GridHelperPlaneNormal);
var myGridHelper = new THREE.GridHelper(10, 20);
myGridHelper.rotation.setFromQuaternion(quaternion);
Is this a viable solution?