I have a problem, I want my camera to rotate along the Y axis while he is looking at the player with an offset. I want to rotate with Q and E key to right and left around the player but on my Camera Follow Player Script I used Vector3.SmoothDamp to follow the player on the other side when I try to rotate with Keys with transform.RotateAround() it seems like its locked on the Y axis I dont know how to get around this.
Code:
void CameraFollowPlayer()
{
transform.position = Vector3.SmoothDamp(transform.position, player.position + offset,
ref velocity, smoothSpeed * Time.deltaTime);
transform.LookAt(player.position);
}
void RotateRightLeft ()
{
if(Input.GetKey (KeyCode.E))
{
transform.RotateAround(player.position, transform.up, rotateSpeed * Time.deltaTime);
}
if(Input.GetKey (KeyCode.Q))
{
transform.RotateAround(player.position, -transform.up, rotateSpeed * Time.deltaTime);
}
}