- Home /
transform.RotateAround acting strange
So I tried to make the mouse control my 3rd person camera. It appeared to work just fine at first, and it does horizontally. But when moved vertically the camera loops around the player even though on the other side the camera isnt upside down. Basically on the on the other side the mouse controls flip. Also if the mouse has been moved to face the side of the player (it doesnt matter which way the player is facing. the effect is global) it begins making circles when moved up or down.
if (Input.GetAxis ("Mouse X")!=0)
{
transform.RotateAround (target.transform.position, new Vector3(0, 1, 0), Input.GetAxis ("Mouse X")*8);
}
if (Input.GetAxis ("Mouse Y")!=0)
{
transform.RotateAround (target.transform.position, new Vector3(-1, 0, 0), Input.GetAxis ("Mouse Y")*8);
}
Learning the difference between Vector3.up and transform.up early on can save you a lot of headaches.
Jesus, mary, and the seven sexless angels bless you. I've wasted FOUR F-U-C-$$anonymous$$-I-N-G hours on this, and now it works.
Answer by YamiZee · Jun 11, 2014 at 07:45 AM
Figured it out. It was being global. I used "transform.TransformDirection" on both of the new vectors to fix it.
Your answer
![](https://koobas.hobune.stream/wayback/20220613151259im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Make player face same direction as camera. 4 Answers
Multiple rotate with mouse 2 Answers
How to make Camera unable to move, in Mouse X 1 Answer
Rotate Player with Camera rotation 2 Answers
Limiting the rotation to 180 degrees 0 Answers