Hello. I’ve got another problem. I’ll explain.
So I’ve got a bunch of objects. I tell them to move to a target location. Right now they start moving right after the click. How can I make them rotate to face the direction they’re about to move before doing anything else?
I’ve tried writing like this. This, however, does not work.
//squad[] is where I hold the objects
if(squad[index].transform.rotation != Quaternion.LookRotation(direction)) {
squad[index].transform.rotation = Quaternion.Slerp(squad[index].transform.rotation, Quaternion.LookRotation(direction), Time.deltaTime * 10);
}
else {
squad[index].transform.position = Vector3.MoveTowards(squad[index].transform.position, target, Time.deltaTime * 2);
}
Surely there’s a better way to do this.