Transform.Translate not working

Hey there.

I'm trying to set it up so that, when I press Shift, the character plays a certain animation and dashes forward a bit (Forward being to the right or left, depending on which direction you were facing). I assume that you would use transform.Translate for that, but it's not doing anything. The code is as follows:

 var tackleSound : AudioClip;

function Update () {

    var isDoor : GateOpen = GetComponent(GateOpen); 

        if (Input.GetButtonDown ("Action")) {
            animation.Play ("shouldertackle");
            transform.Translate(Vector3(5, 0, 0) * Time.deltaTime);

I've also tried most of the code snippets from the website's scripting reference, none of which have worked either. What's with this?

GetButtonDown only runs once when the button is first pressed.

deltaTime is a tiny, sub-second value unless your framerate is really bad. Translate is probably working but it isn't moving the character very far. (You could test this by moving it a larger amount.)

Instead, you probably want to move a longer distance, gradually over time. A useful function for that is Lerp, and it's explained very well here: