- Home /
Third Person Controller Question
Hello. I want to make a script for the third person controller. I want it to work like this. I basicly want it so when you move the mouse around it will rotate around the player.
Thanks
Answer by CodeMasterMike · Feb 06, 2013 at 06:06 AM
I can't see any youtube links at the moment, but since you say you want to rotate the camera around the player character, I think you want something like this:
vector3 CharacterPosition;
void Update ()
{
transform.RotateAround(CharacterPosition, Vector3.up, 20 * Time.deltaTime);
transform.LookAt(CharacterPosition);
}
This example code will look at a position, and rotate around it. So what you need to do, is to create a script on your camera, and when you move your mouse (depending on how you want to achieve that), then you do something like the code above.
So basically:
When mouse move -> RotateAround player position, and, LookAt player position.
Good luck!
Your answer
![](https://koobas.hobune.stream/wayback/20220613092225im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Spray painting 0 Answers
Help Touch inputs 0 Answers
Question about precise movement 2 Answers
I need help for my RTS Games! 0 Answers