Dodge Effect - Left/Right Movement

I accidentally posted this question in the forums the first time, whoops.

So I’m trying to get my player character to get a dodge effect when the player double taps “A” or “D” to avoid enemy fire. I have the double tap and everything programmed in, and it works when it happens, but the effect is lacking when the player is on the ground. When the player double taps in the air, I have my desired effect ( A quick burst of speed to the left or right ). It seems that the ground stops this from happening. I have tried to put a zero friction surface under him, but that didn’t work. I will let you know, that this game is based on a rail/spline which is constantly moving the player along no matter what. Let me know if anyone has any suggestions to get the player to do this quick left/right motion while on the ground. I would appreciate it.

Here is my code so far…

using UnityEngine;
using System.Collections;

public class PlayerDodge : MonoBehaviour {

public Rigidbody rb;
public float dodgeSpeed;
public Vector3 dodge = new Vector3 (5, 5, 5);
public float buttonCoolDown = 0.5f;
public float lastTapTime = 0;


void Start ()
{
GameObject player = GameObject.Find("ThirdPersonController");
rb = player.GetComponent<Rigidbody>();

lastTapTime = 0;

}

void Update ()
{

if (Input.GetKeyDown("d"))
{
if((Time.time - lastTapTime) < buttonCoolDown)
{
DodgeRight();
}

lastTapTime = Time.time;
}

if (Input.GetKeyDown("a"))
{
if((Time.time - lastTapTime) < buttonCoolDown)
{
DodgeLeft();
}

lastTapTime = Time.time;
}

}

void DodgeRight()
{
rb.AddForce(dodge * dodgeSpeed );
}

void DodgeLeft ()
{
rb.AddForce(-dodge * dodgeSpeed );
}

}

I have noticed that the player may be colliding with the ground. My question to that is, can I avoid the ground by using the code I’m currently using? Or is there a better way to implement instead of using AddForce?

If I understand correctly, your character is on rails, so whether you’re on the ground or not is more important for appearance and state of actions. You could set the ground collider as a Trigger, so that it won’t have any friction at all. Then use the OnTriggerStay() function to push the character out of the ground if it intersects, or rely on the rails system to bound the character out of the ground.