I’m not quite sure what I’m doing wrong here. I’m applying FromToRotation twice in a row (for a test) and the results aren’t quite what I expect.
Quaternion startRotation = Quaternion.FromToRotation(transform.forward, startPosition);
transform.rotation = startRotation;
Debug.Log(transform.forward.normalized + " " + startPosition.normalized); // These two are the same - Good!
//find target rotation
targetRotation = Quaternion.FromToRotation(transform.forward, targetPosition);
//rotate sphere to move missile to start location
transform.rotation = targetRotation;
Debug.Log(transform.forward.normalized + " " + targetPosition.normalized + " " + targetRotation*startPosition.normalized); First is different from the 2nd and 3rd, which are the same (Bad)!
Initially, transform has no rotation.
The first FromToRotation works as expected, i.e. transform.forward is in the same direction as startPosition.
When I transform it a second time, however, transform.forward is not equal to targetPosition! However, targetRotation * startPosition is equal to targetPosition. What am I doing wrong?