public override List <BeamHandler> OnBeamCollision(BeamHandler beam, RaycastHit hit) { Vector3 reflectedDir = Vector3.Reflect(beam.GetDir(), hit.normal); var beams = new List <BeamHandler>(); BeamHandler continuation = game.CreateBeam(hit.point + 0.000001f * beam.GetDir(), beam.GetDir()); BeamHandler reemission = game.CreateBeam(hit.point, reflectedDir); beams.Add(continuation); beams.Add(reemission); return(beams); }
public override List <BeamHandler> OnBeamCollision(BeamHandler beam, RaycastHit hit) { Vector3 reflectedDir = Vector3.Reflect(beam.GetDir(), hit.normal); var beams = new List <BeamHandler>(); beams.Add(game.CreateBeam(hit.point, reflectedDir)); return(beams); }
public override List <BeamHandler> OnBeamCollision(BeamHandler beam, RaycastHit hit) { Vector3 reflectedDir = Vector3.Reflect(beam.GetDir(), hit.normal); var beams = new List <BeamHandler>(); // Low-intensity beams are destroyed on contact with a beam-splitter, // since both re-emissions are too dim to trigger anything. if (beam.intensity > 0) { BeamHandler continuation = game.CreateBeam(hit.point + 0.000001f * beam.GetDir(), beam.GetDir(), beam); BeamHandler reemission = game.CreateBeam(hit.point, reflectedDir, beam); continuation.intensity -= 1; reemission.intensity -= 1; beams.Add(continuation); beams.Add(reemission); } return(beams); }