In Vector math and translations we can do:
dir = (v1 - v2).norm
and then v1.translate(dir * 50)
so v1
moves to the v2
's direction.
What about rotation
and eulerAngles
?
Here's my attempt, but it doesn't work, probably from some obvious reasons.
Vector3 initial = ob1.transform.rotation.eulerAngles; // get it's initial rotation
ob1.Rotate(new Vector3(0,0,90)); // rotate
Vector3 after = ob1.transform.rotation.eulerAngles; // store new rotation
ob1.Rotate(new Vector3(0,0,-90)); // rotate back to initial
// here I need to calculate the direction so I can do rotate(dir * 50); or something similar
I need to get the rotation direction, so I can rotate the object continously with direction, not with a fixed desired angle value.
To be super clear, I need to get this blue line direction:
The object is initially rotated by (0,0,57)
.
I need to rotate it around it's center (green axis).
I know I can do logo1.transform.RotateAround(logo1.transform.position, logo1.transform.up, 80);
and it works, but I need the direction from this, so I can use it in Tweening.