What i have so far:
void Update ()
{
Ray ray = new Ray (transform.position, transform.forward);
RaycastHit hit;
Debug.DrawLine(ray.origin, transform.forward, Color.red);
if (Physics.Raycast (ray, out hit, rayLength, WallLayer))
{
Vector3 reflectdir = Vector3.Reflect(ray.direction,hit.normal);
ray = new Ray(hit.point, reflectdir);// is this the right way?
Debug.DrawLine(ray.origin, hit.point, Color.blue);
if(hit.collider.gameObject.tag == "wall")
{
Instantiate(WayPoint, hit.point, Quaternion.identity); //everytime the ray hits the wall create one
}
}
}
Any Ideas?