The can have the values: YNegative, Ypositive, XNegative, XPositive, ZNegative, ZPositive
What i want to do is rotate the scene based on what these properties are assigned to.
the cases i have listed below:
//If axisUp = Y ignore because three js uses right handed system where y is always up
//If axisUp = Z i believe i need to rotate the x axis. not sure why
//if axisUp= X not sure what needs to be done
//If axisRight:x then do nothing as x already right
//If axisRight = Z i believe i need to rotate the x axis. not sure why
//If axisRight= Y not sure what needs to be done.
example:
//not sure if correct
if (axis.axisUp === “z_positive”) {
scene.rotation.x = -90 * Math.PI/180;
}
Could you explain what you want to archive? To use a different “up-axis” you can set the up axis of any object or mesh with myObject.up.set(1.0, 0.0, 0.0) for positive-x for example, or set the THREE.Object3D.DefaultUp before any objects are created.
You need to apply it to each single object you want to apply the axis. That’s why THREE.Object3D.DefaultUp might be useful for you.
In case you need to change the axis at runtime you could also create a new global Vector3 you overwrite the up property on each object you want to change dynamically (propbally all objects in the scene). Only if the up vector is purposed to be equal on all objects.
If you don’t have too much objects you could also simply traverse the scene and set the up axis on each object of the baseclass Object3D. (object3d, mesh, light, camera etc.)
Your camera get’s this up vector too, so nothing changes visially, but the coordinate system. If you want the camera to stay default skip cameras on the traversal.
so when i specify child.up.set this is setting the camera up position too? i thought it would only set up.
how can i skip it?
when i do scene.rotation.x = -90 * Math.PI/180; it is visually showing be the change.
im sure with the child.up.set code you provided i should not only see the coordinate change but also visually because currently my model has y up so if i run the rotate function on my model it should change the z up therefore there should be some visual changes too.