Hello All,
I’m quite new in Unity.
I have two gameobjects. I would like to solve, that the GameObject A face and move in the direction of GamObject B.
If I simply use this code:
var start = object_A.transform.position;
var end = object_B.transform.position;
object_A.transform.Translate((end - start) * 0.1f * Time.deltaTime);
…it’s working pretty well, the gameobject A started to move straight in the direction of B.
But if I would like to rotate, to facing A to B, the movement’s path will be not a stright line, but a curve.
Quaternion rotationLookAt = Quaternion.LookRotation(end - start);
object_A.transform.rotation = Quaternion.Slerp(object_A.transform.rotation, rotationLookAt, Time.deltaTime * 5f);

How can I solve, that even if I rotate A to facing B, the movement doesn’t be a curve but a straight line?
Thank you