Light beam for illumination

Hey all! I am trying to create an item similar to the X-Ray visor from Super Metroid. Basically, I am making a 2d game, and I want to use a ray of light emitting from the player that is controllable.

My assumption is that this would be done with raycasting, but I’m struggling with how to rig light to it as well as how to change the direction based on control input. Any help would be amazing!

Note: I am using the free version of Unity, version 4.6.1f1

I’ve included a still from Super Metroid as a reference for what I am trying to make. I am pretty much trying to duplicate this.

51964-x-ray-scope.png

use a second camera with script : http://wiki.unity3d.com/index.php?title=IsVisibleFrom to finde if a object is rendered by camera then change shader :
_
public Shader shader2;

this.GetComponent().material.shader = shader2;
_

Since even the black background is getting lit up, the image looks like a mostly transparent, otherwise white (color guess(r,g,b,a)= (1.0,1.0,1.0,0.7) ), triangle is drawn over, and alpha-blended (transparency blending), with everything below it.

One corner of the triangle is fixed to the character’s head, and it’s orientation is defined by where the character is facing.

I don’t think you will need to use real lighting effects and/or raycasting to achieve this effect.

You can easily do this with 2 cameras and a depth shader. If you want to create the light dimming effect you’ll need a semi-transparent overlay that the depth shader can hit.

See my answer here for step-by-step setup details: http://answers.unity3d.com/questions/1163458/use-an-object-as-a-mask-for-a-camera.html?childToView=1348801#answer-1348801