Please take a look at the following tutorial from the Roblox wiki: http://wiki.roblox.com/index.php?title=Making_a_ray-casting_laser_gun - a simple and classic ray casting laser gun.
What I cannot understand is how to configure a ray, i.e. the laser beam in the tutorial, such that (a) it goes through all obstacles (b) ray stops projecting as soon as it is hit (i.e. on the first intersection)
If I shoot a laser beam, I normally don't want it to go past walls! But I can imagine some situations where I would want that. So both scenarios are important to consider.
Can someone help me understand how to approach these issues maybe helping me dig through the documentation?
That tutorial uses the method of workspace FindPartOnRay(). Workspace has another method, FindPartOnRayWithIgnoreList(), which takes a second parameter that is an array of instances to ignore. An intersection with any instance in this array, or as a child of an instance in this array, will be ignored.