Does anyone know how to convert a Y axis rotation into a Z axis rotation. I’m trying to translate the center Y spin of a plane to the center Z spin of another plane, like taking a horizontally spinning wheel and turning it vertical. I think this can be done using the euler values, but I can’t seem to get it right.
Thanks
Here is an example:
public class LockStep : MonoBehaviour {
public GameObject goMatchRotation;
void Update () {
Vector3 v3T = goMatchRotation.transform.localEulerAngles;
float fT = v3T.z;
v3T.z = v3T.y;
v3T.y = fT;
transform.localEulerAngles = v3T;
}
}
I finally figured it out, here’s the solution. Copy the Y+90 to X and set static 270 to Y and 90 to Z.
transform.eulerAngles = new Vector3(sourceObject.transform.eulerAngles.y + 90, 270f, 90f);