Line Renderer bounce

I currently have a "laser sight" on my player character using a Line Renderer and a raycast. The player character shoots balls that bounce off of walls. I am trying to achieve an effect with my laser sight that you see in most Pool games- a line that works like a laser sight, but when the end of the line comes in contact with the sides of the pool table, an angle of ricochet is displayed letting the player know were the ball is going to bounce. The picture below shows exactly what I am trying to achieve:

alt text

EDIT

I am having a bit of trouble with the implementation. The line does not seem to be reflecting or bouncing, instead they seem to be overlapped on top of each other. See code:

var hit : RaycastHit;

// these are set in start private var line : LineRenderer;

private var point01 = Vector3(0,0,0);

function Start () {

line = this.gameObject.AddComponent(LineRenderer);

}

function Update () {

    line.SetPosition(0, point01);
    Physics.Raycast(transform.position,transform.forward,hit);
    if(hit.collider)
    {
        line.SetPosition(1,Vector3(0,0,hit.distance));

        line.SetPosition(2, Vector3.Reflect(Vector3(0, 0, hit.distance), Vector3.right));

    }   
    else
    {
        line.SetPosition(1,Vector3(0,0,5000));

    }

I guess this two things should be enough : Vector3.Reflect and RaycastHit.normal. If you want to bounce multiple times you have to raycast again for every bounce. But the accuracy is getting worse each bounce.


edit

Another problem is that your ball is not infinite small like a raycast. That means your ball is touching the wall a bit earlier. You can use Physics.SphereCast() but if your ball/projectile have not a spherical form it’s getting difficult.