Hi all, i need to find a way to reproduce unity3 rotation on a simply server that dosn’t have fancy unity3 functionality.
So far i have come up with:
`public static Vector3 Rotate(Vector3 x, float _x, float _y, float _z)
{
float angle = _z;
x = new Vector3(
x.x * Mathf.Cos(Mathf.Deg2Rad * angle) - x.y * Mathf.Sin(Mathf.Deg2Rad * angle),
x.x * Mathf.Sin(Mathf.Deg2Rad * angle) + x.y * Mathf.Cos(Mathf.Deg2Rad * angle),
x.z);
angle = _y;
x = new Vector3(
x.x * Mathf.Cos(Mathf.Deg2Rad * angle) + x.z * Mathf.Sin(Mathf.Deg2Rad * angle),
x.y,
-x.x * Mathf.Sin(Mathf.Deg2Rad * angle) + x.z * Mathf.Cos(Mathf.Deg2Rad * angle));
angle = _x;
x = new Vector3(
x.x,
x.y * Mathf.Cos(Mathf.Deg2Rad * angle) - x.z * Mathf.Sin(Mathf.Deg2Rad * angle),
x.y * Mathf.Sin(Mathf.Deg2Rad * angle) + x.z * Mathf.Cos(Mathf.Deg2Rad * angle));
return x;
}`
However i can’t reproduce rotation angles that i input from transform.rotation.eulerAngles, on some angles it works on some not, any idea why?