So I’m making an fps from scratch and need to have the player rotate when the mouse moves but with just this
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition + Vector3.forward * 2f);
transform.LookAt (mousePos);
the player rotates too fast and theres no bounding box and i looked and can’t find anything on this
Ok so I found some stuff and got that part to work but now it wont continue to rotate if the mouse is off screen any help?
void FixedUpdate()
{
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition + Vector3.forward * 2f);
Vector3 direction = mousePos - transform.position;
Quaternion toRotation = Quaternion.FromToRotation(transform.forward, direction);
transform.rotation = Quaternion.Lerp(transform.rotation, toRotation, 0.1f * Time.time);
}