I’m working on a third person camera that follows where the player is looking at as follows:
var hit : RaycastHit;
if (Physics.Raycast(transform.parent.position, transform.parent.TransformDirection(Vector3.forward), hit) ) {
transform.LookAt(hit.point);
}
There’s no problems with this code exactly, all compiles and works as intended, except I noticed a few jarring issues when the camera’s LookAt point snaps from a somewhat near wall to a distant wall (just drifting over a corner, for example). Is there a way to Slerp the LookAt so instead of instantly changing it would adjust quickly over a second?
Wondering if you can post your code for using hit.point as a target for Quaternion.Slerp. I’m having a problem getting my transform to slerp toward a raycast hit.point. How did you solve this problem? Thanks for the help.