Move camera at certain speed to the right but follow player in Y ?
The player is only moving to the right as well and the speed of the camera varies depending on the player actions. Ex:
 public float CameraScrollSpeed()
     {
         float speed = 9.4f;//default speed
 
         if (isClimbing)
             return 2.5f;
         else if (isRunning)
             return 7.0f;
         else if (isDashing)
             speed = 20.0f;
 
         //Screen pos is players position ralative to screen
         if (screenPos.x > Screen.width * 0.4f)
             speed = 20;
 
         return speed;
     }
The default speed is normally faster than the player movement, the thing is I need the camera to have a limit when the player is too far to the right while still advancing. I tried making a simple camera follow while using MoveTowards() to move camera, but the camera stutters badly when the player reaches the limit
 public void CameraMove(){
                float speed = CameraScrollSpeed();
 
                transform.Translate(Vector3.right * speed * Time.deltaTime);
                 playerPos.x = transform.position.x;
                 transform.position = Vector3.Slerp(transform.position, playerPos, SmoothFactor);
 
 }
Any ideas?
Your answer
 
 
             Follow this Question
Related Questions
SmoothCameraCrouch 2 Answers
Accelerate float rather than decelerate with Mathf.SmoothDamp 0 Answers
problem ghosting camera with 2 objets 0 Answers
How to modify this script to not rotate the camera when I rotate the player. 1 Answer
moving the camera smoothly to players current position in unity 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                