Stop Animation then reverse after collision

public void OnCollisionEnter(Collision collision)
if(collision.gameObject.tag == “Interactable”)
GetComponent().SetBool(“Idle”, false);
GetComponent().SetBool(“Run”, false);
GetComponent().SetBool(“regularAttack”, true);
GetComponent().SetFloat(“Speed”, -0.2f);

i’m trying to stop the animation “regularAttack” and play it backwards when colliding with “Interactable”

but is not working. Any Help would be awesome!!!

I see you seem to be on the right track. See if you missed something:

  1. Inside the Animator window, add a parameter of type float named “My Speed Mult”.
  2. Select the state containing the animation and turn on the Parameter. Select the parameter “My Speed Mult”. This allows you to multiply the animation segment speed by the value of the parameter.
  3. Change the “My Speed Mult” parameter value inside your script. If you need to reverse the animation, set it to a negative value. You need to keep in mind that it is executing a multiplication with Speed value of State.