Rotation towards raycast hit point,


Simple code to face target once i click on object. Which works as i would like.

Vector3 direction = (position - transform.position).normalized;
        Quaternion lookRotation = Quaternion.LookRotation(new Vector3(direction.x, 0f, direction.z));
        transform.rotation = Quaternion.RotateTowards(transform.rotation, lookRotation, Time.deltaTime * turnSpeed);

Biggest issue right now is that if i pass in raycast hit.point it does not rotate it correctly.
I have set the update rotation to false (to disable agent update rotation)
The basic idea is that i would like to handle rotation without NavMeshAgent the same way i handle it once i click on target (to face it)

For position i pass in target (which is Transform) .position (Vector3) and in click state i pass hit.point (Vector3) from Raycast hit.

Is there something i could do to normalize this and rotate to Raycasthit hit.point location the same way i do for facing target?

I am using NavMeshAgent
I do not want to use NavMeshAgent rotation handler because rotation is way too slow and it starts to walk before rotating object (for example if i want to walk in 180 degree then rotation happens after period of time and differs from then i face target using script)


After hours and 1 topic in Unity forum i found out that i did all of this for Raycast hit.point in CLICK method (1 frame) not in update so the look rotation was correct just rotating did not work accordingly because it did that in 1 frame not in update process.