- Home /
Question by
Abbrew · May 11, 2018 at 04:00 AM ·
camerarotatecamera-movementrotate-around
Camera RotateAround not rotating around center like a planet
I am trying to get the camera to rotate around a GameObject as if it were a planet. However, the code is not working as expected.
public void PlayerRotateRight(Transform focus,float amount){
cam.transform.RotateAround(focus.position, Vector3.up, amount);
}
Above is the code. focus is guaranteed to be a Gameobject away from the camera. Amount is guaranteed to be a positive value. cam is a Camera object and working as it should. Despite all of this the camera is rotating around its own axis, not around the GameObject
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612162429im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to rotate my camera? 2 Answers
RTS type of camera 1 Answer
Sidescroller Turning 1 Answer