Whenever I look down my character moves on its own

For my game, I want to have a grappling gun, but I had an issue where if I look down (not fully) my character starts moving to the left, here is the grapple gun code

using UnityEngine;
public class GrapplingGun : MonoBehaviour
    private LineRenderer lr;
    private Vector3 grapplePoint;
    public LayerMask whatIsGrappleable;
    public Transform gunTip, camera, player;
    private float maxDistance = 100f;
    private SpringJoint joint;
    void Awake() {
        lr = GetComponent<LineRenderer>();
    void Update() {
        if (Input.GetMouseButtonDown(0)) {
        else if (Input.GetMouseButtonUp(0)) {
    //Called after Update
    void LateUpdate() {
    /// <summary>
    /// Call whenever we want to start a grapple
    /// </summary>
    void StartGrapple() {
        RaycastHit hit;
        if (Physics.Raycast(camera.position, camera.forward, out hit, maxDistance, whatIsGrappleable)) {
            grapplePoint = hit.point;
            joint = player.gameObject.AddComponent<SpringJoint>();
            joint.autoConfigureConnectedAnchor = false;
            joint.connectedAnchor = grapplePoint;
            float distanceFromPoint = Vector3.Distance(player.position, grapplePoint);
            //The distance grapple will try to keep from grapple point. 
            joint.maxDistance = distanceFromPoint * 0.8f;
            joint.minDistance = distanceFromPoint * 0.25f;
            //Adjust these values to fit your game.
            joint.spring = 4.5f;
            joint.damper = 7f;
            joint.massScale = 4.5f;
            lr.positionCount = 2;
            currentGrapplePosition = gunTip.position;
    /// <summary>
    /// Call whenever we want to stop a grapple
    /// </summary>
    void StopGrapple() {
        lr.positionCount = 0;
    private Vector3 currentGrapplePosition;
    void DrawRope() {
        //If not grappling, don't draw rope
        if (!joint) return;
        currentGrapplePosition = Vector3.Lerp(currentGrapplePosition, grapplePoint, Time.deltaTime * 8f);
        lr.SetPosition(0, gunTip.position);
        lr.SetPosition(1, currentGrapplePosition);
    public bool IsGrappling() {
        return joint != null;
    public Vector3 GetGrapplePoint() {
        return grapplePoint;

I know this is a very late response, but for anyone who has this problem, check if there are any colliders that may be pushing the player. For example, in this instance, the tutorial OP is following creates a cube that follows the camera that acts as a grappling gun. Therefore, when the grappling gun enters the player’s collider (when looking down, since it’s connected to the camera), the gun will push the player to the left. To fix this, turn off the gun’s collider so that when looking down, the gun doesn’t collide with the player, and therefore doesn’t push the player object.

Do you have any other scripts/colliders attached to the player. My guess is that the lerp could be moving the player… but you may have something else causing the player to move. I.e. a collider that is causing the character to move.

Hey did you solve it ?

What ever it is its not a problem with ur code, because im using the same code and i have the same problem, but its hapening only in my main scene and not in my test scene even tho the code is the same. Also i have its happeing when i am on the ground, when i look down my character just moves left in global orientations.