I want to rotate the camera around the player by pressing E and Q but it doesnt rotates around the player. I tried RotateAround but didnt worked.
Code:
public Transform player;
public float smoothSpeed = 0.125f;
public float rotateSpeed;
public Vector3 offset;
private Vector3 velocity = Vector3.zero;
void LateUpdate ()
{
transform.position = Vector3.SmoothDamp(transform.position, player.position + offset, ref velocity, smoothSpeed * Time.deltaTime);
}
void Update()
{
if(Input.GetKey (KeyCode.E))
{
transform.RotateAround(player.position, Vector3.up, rotateSpeed * Time.deltaTime);
}
if(Input.GetKey (KeyCode.Q))
{
transform.RotateAround(player.position, -Vector3.up, rotateSpeed * Time.deltaTime);
}
}
}