Question by 
               lilmouton · Dec 14, 2019 at 09:23 AM · 
                movementvector3lerpvector3.lerpvector3.movetowards  
              
 
              Vector3.Lerp not moving object backwards
I'm trying to slowly move my player's camera position backwards every time he jumps then slowly back to the original position when he lands. When activating my game, the script moves my game object forward instead of back.
The "thatOne" declaration is from the camera's script and it has the Vector3 position of the camera I'm trying to change, if anyone could help, I'd gladly appreciate it.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class PlayerMovement : MonoBehaviour
 {
     public float horizontalInput;
     public float speed = 10;
     public float sideSpeed = 5;
     public Rigidbody rb;
     public bool isOnGround = true;
     public GameObject came;
     private FollowPlayer thatOne;
     public Vector3 sum = new Vector3(0, 0, -10.5f);
     public float speedf = 0.5f ;
     // Start is called before the first frame update
     void Start()
     {
         
     }
 
     // Update is called once per frame
     void FixedUpdate()
     {
         // Set Horizontal movement 
         horizontalInput = Input.GetAxis("Horizontal");
         transform.Translate(Vector3.forward * speed * Time.deltaTime);
         transform.Translate(Vector3.right * sideSpeed * Time.deltaTime * horizontalInput);
         if (Input.GetKeyDown(KeyCode.Space) && isOnGround)
         {
             thatOne = GameObject.Find("Main Camera").GetComponent<FollowPlayer>();
             rb.AddForce(new Vector3(0, 150, 100), ForceMode.Impulse);
             isOnGround = false;
         }
         if (isOnGround == false)
         {
             float movingPos = speedf * Time.deltaTime;           
             thatOne.cameraPosition = Vector3.Lerp(thatOne.cameraPosition, sum, movingPos);
         }
     }
     private void OnTriggerEnter(Collider other)
     {
         if (other.tag == "Ground")
         {
             isOnGround = true;
         }
     }
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
DOTween sequence snapping 0 Answers
Smooth Forward Movement with a CoRoutine 1 Answer
Smoother grid based movement using coroutines and lerp 0 Answers
GameObject Smooth Movement 0 Answers
ridgidbody AddForce in direction player is pointed? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                