I can’t find how to move my camera around the player but stop it before it reaches the ground. Here’s my code:
void Start()
{
offset = new Vector3(player.position.x + camPosX, player.position.y + camPosY, player.position.z + camPosZ);
transform.rotation = Quaternion.Euler(camRotationX, camRotationY, camRotationZ);
transform.LookAt(player.position);
}
// LateUpdate is called after Update each frame
void LateUpdate()
{
offset = Quaternion.AngleAxis(Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * Quaternion.AngleAxis(Input.GetAxis("Mouse Y") * turnSpeed, Vector3.right) * offset;
transform.position = player.position + offset;
transform.LookAt(player.position);
}