Question by 
               Flegy · Jan 12, 2017 at 03:35 AM · 
                unity 5cameraorbitfollow player  
              
 
              camera problem orbit/fallow
I have problem with simple script what fallow character and on mouse move camera rotation arround character, but problem is both cannot work toget. If comment transform.position = lookAt.position + startOffset; than rotation work fine but not fallowing camera , if comment transform.LookAt(lookAt.position); than following work fine but rotation not. How can make both to work?
  void Start()
     {
         lookAt = GameObject.FindGameObjectWithTag("Player").transform;
         startOffset = transform.position - lookAt.position;
     }
 
     void Update()
     {
 
         // move camera near character
         transform.position = lookAt.position + startOffset;
         transform.LookAt(lookAt.position);
 
         currentX = Input.GetAxis("Mouse X");
         currentY = Input.GetAxis("Mouse Y");
         currentY = Mathf.Clamp(currentY, Y_ANGLE_MIN, Y_ANGLE_MAX);
 
         transform.RotateAround(lookAt.transform.position, Vector3.up, currentX * OrbitSpeed);
        
 
 
         // if is first person camera on allow up/down
         //if (mycam.enabled)
         //{
         //    Debug.Log("work");
         //}
     }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
camera falling down when following player!! 1 Answer
Distance lens flare jittering everywhere 0 Answers
Smooth Look at... 2 Answers
Trying to put a canvas in Google Cardboard 0 Answers
How can I rotate a camera to keep an object within screen bounds? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                