shoo
1
Hello! I am trying to use Quaternion.LookRotation to rotate my objects toward some point, but it looks like it working but gives innacurate result(like +/- 5 degrees).
Quaternion lookRotation = Quaternion.LookRotation(wallEnd.normalized, Vector3.up);
GameObject newWall = GameObject.Instantiate(woodWall, spawnPosition, lookRotation) as GameObject;
But then when I use Transform LookAt it works fine!
GameObject newWall = GameObject.Instantiate(woodWall, spawnPosition, Quaternion.identity) as GameObject;
newWall.transform.LookAt(wallEnd);
Am I doing something wrong? How can I get accurate angle with Quaternion.LookRotation?
Picture:

I assume that wallEnd is simply a position vector, whereas LookRotation wants a direction vector. Try adding the wallEndDirection line below and placing wallEndDirection inside of the LookRotation function.
Vector3 wallEndDirection = (wallEnd - spawnPosition).normalized;
Quaternion lookRotation = Quaternion.LookRotation(wallEndDirection, Vector3.up);
GameObject newWall = GameObject.Instantiate(woodWall, spawnPosition, lookRotation) as GameObject;