title: Rotate object around a center object
body: <p>Hi guys I wrote this code to rotate an object around a center object but I am doing somthing wrong could someone explain me what :)? </p>
  
  <pre><code>public void RotateCamera(GameObject _center)
  {
      Vector3 mousePos = camera.WorldToScreenPoint(Input.mousePosition);
      Vector3 centerPos = camera.WorldToScreenPoint(_center.transform.position);
      float angle = Vector3.Angle(centerPos,mousePos);
      Camera.mainCamera.transform.Rotate(centerPos,angle);
  }
  </code></pre>
  
  <p>Updated code still doesnt work:</p>
  
  <pre><code>void Update()
  {
  RotateCamera(_player);
  }
  
  public void RotateCamera(GameObject _center)
  {
      float speedMod = 10.0f;
      Vector3 mousePos = camera.WorldToScreenPoint(Input.mousePosition);
      Vector3 centerPos = _center.transform.position;
      Camera.mainCamera.transform.LookAt(centerPos);
      Camera.mainCamera.transform.RotateAround (centerPos,mousePos,20 * Time.deltaTime * speedMod);
  }
  </code></pre>