- Home /
 
 
               Question by 
               iBayan · Jun 13, 2016 at 06:01 AM · 
                cameracamera follow  
              
 
              camera that follow the player ?
hello, I am a beginner in unity so I really don’t know a lot. I want to have a camera that follow the player like the one in this video : https://www.youtube.com/watch?v=N10nzviJQZc I tried to follow one tutorial and use the MultipurposeCameraRig, but it only show the player back it doesn’t let me see the player face when rotating. its like attached to the player back. any tip or tutorial ?
               Comment
              
 
               
              Answer by EpiFouloux · Jun 13, 2016 at 09:28 AM
You need a camera attached to the player, and use Transform.RotateAround()
 private GameObejct _cam;
 private GameObject _player;
 
 void Update()
 {
  int x = Input.getAxis("horizontal");
  if (x == 0f)
   return ;
  Vector3 axis = (x > 0f ? Vector3.right : Vector3.left);
  _cam.transform.RotateAround(_player.transform.position, axis, x * Time.deltaTime);
 }
  
 
               I guess something like that would work !
Your answer