Hello, I am trying to Quaternion.lerp an object from one rotation to another, to show the shortest path between two points on a globe. The way I am showing the paths is to spawn an empty game object in the center of the sphere, with a trail object as a child. I have attached an image of the results of how my code is currently working. There are also some line renders on the bottom of the globe that barely move at all, and the final destination that the points converge on is not the actual destination, they are a little below the actual position that I pass.
My current code looks like this:
Transform startRot;
Transform endRot;
bool pathing = false;
void FixedUpdate() {
if (pathing) {
Vector3 targetDir = endRot.position - transform.position;
Quaternion toRotation = Quaternion.FromToRotation(transform.forward, targetDir);
transform.rotation = Quaternion.Lerp(transform.rotation, toRotation, 1f *Time.deltaTime);
}
}
public void StartPathSequence(Transform s, Transform e){
startRot = s;
endRot = e;
transform.LookAt (startRot);
transform.GetChild (0).position = startRot.position;
pathing = true;
}