Answers for "Slerp to make the right/left side face another object"
http://answers.unity.com/questions/1624845/slerp-to-make-the-rightleft-side-face-another-obje.html
The latest answers for the question "Slerp to make the right/left side face another object"Answer by highpockets
http://answers.unity.com/answers/1624962/view.html
You should never set the directional vectors of a transform, you will get very strange results sometimes because setting transform.right does not necessarily mean that transform.forward or transform.up will end up where you want them.
----------
You should get the axis to rotate first (if transform.right is exactly 180 degrees away from direction, you will have to rotate just a smidge for this to work) :
----------
if(-transform.right == direction){
transform.Rotate(0, 0.1f, 0); //rotate a smidge on the y axis to get less than 180 degrees
}
Vector3 axis = Vector3.Cross( transform.right, direction );
----------
Now get your angle:
----------
float angle = Mathf.Sqrt(Vector3.Dot(direction, direction) * Vector3.Dot(transform.right, transform.right)) + Vector3.Dot(direction, transform.right);
----------
Now create your quaternion:
----------
Quaternion newRot = new Quaternion(axis.x, axis.y, axis.z, angle).normalized;
----------
Now we get our target rotation based on this new rotation we need to apply to our existing rotation:
----------
Quaternion targetRotation = newRot * transform.rotation;
----------
Now apply that to slerp:
----------
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, timer);
timer = timer + Time.deltaTime;
----------
That should work for you.
CheersMon, 22 Apr 2019 22:35:15 GMThighpocketsAnswer by Magso
http://answers.unity.com/answers/1624929/view.html
public float damping;
Quaternion rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
This is took from the old standard assets SmoothLookAtMon, 22 Apr 2019 20:52:27 GMTMagso