I rotated an object some x, y and z angles. How can I get the axis where this rotation happended?
Or else, quaternion.Angle
give me the rotation relative to wath axis?
To ilustrate, in the image below, I would like to get the rotation of the red stick, just from the initial and final rotations of the blue cube.

Thanks in advance!
I’m afraid I don’t really understand your question. After rotation, you can read the resulting axis from transform.rotation so you can set the rotation of the stick to the same. If you want angles, you can use transform.rotation.eulerAngles. Perhaps you can explain a little more…
I got it working in a not very elegant manner.
What this funcion does is returning the axis where the rotation a to b happended, where you would align the red axis from the gif in the question.
The trilateration funcion used can be found at this link
public Vector3 GetAxisDirection(Quaternion a, Quaternion b)
{
if (a == b)
return Vector3.zero;
Transform t = new GameObject("temp").transform;
t.rotation = a;
Vector3 quinaInicial = t.TransformPoint(1, 1, 1);
t.rotation = Quaternion.Lerp(a, b, 0.5f);
Vector3 quinaMid = t.TransformPoint(1, 1, 1);
t.rotation = b;
Vector3 quinaFinal = t.TransformPoint(1, 1, 1);
float dist = Vector3.Distance(quinaInicial, t.position);
Vector3[] pontosEncontrados = GPS.Trilaterate(quinaInicial, dist, quinaMid, dist, quinaFinal, dist);
Destroy(t.gameObject);
if (pontosEncontrados.Length < 2)
return Vector3.up;
return (pontosEncontrados[0] - pontosEncontrados[1]).normalized;
}
Well, it should be as easy as just getting the quaternion from a to b and grab the x,y,z values of that (or use ToAngleAxis). In order to get the rotation that brings you from “a” to “b” you essentially have to divide one of quaternion by the other. Here it’s going to get tricky since quaternion multiplication (and division) is not commutative. Since we only use unit quaternions, in order to divide one by the other you just have to use Quatenion.Inverse on one of them and then multiply them together. You may need to try the right combination as I can’t remember it right now.