how to remove the influence of the animator on the mousePos and / or posDif of the script

I’m trying to make a top down shooter game like enter the gungeon but I have an error in the script, the player animator I’m using in the cursor script has an influence on the posDif and the mousePos, could someone tell me how I can remove this influence?
(If you wanted more information just tell me)

the script is this;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Mouse : MonoBehaviour
{
public Camera cam;
public Animator animator;
Vector2 movement;
Vector2 mousePos;
Vector2 posDif;
public Rigidbody2D rb;

public GameObject otherObject;

void Start()
{
    Cursor.visible = false;
    animator = otherObject.GetComponent<Animator>();
}

void Update()
{
    Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    transform.position = cursorPos;

    mousePos = cam.ScreenToWorldPoint(Input.mousePosition);

    posDif = mousePos - rb.position * Time.deltaTime;

    animator.SetFloat("anonymousouse Horizontal", posDif.x);
    animator.SetFloat("anonymousouse Vertical", posDif.y);
}

}

Try to erase these line :


posDif = mousePos - rb.position * Time.deltaTime;
animator.SetFloat("anonymousouse Horizontal", posDif.x);
animator.SetFloat("anonymousouse Vertical", posDif.y);

If it’s can fix the problems, maybe it’s because the animation cursor that are you use is on the same GameObject.


Hope it helps.