- Home /
Question by
theBuilder10000 · Jul 18, 2016 at 04:55 AM ·
2draycastingraycasthit2dvisual-effectsstealth
How do I create a wide beam thats visible to the player and is stopped by barriers in my 2D stealth game?
I have a series of raycasts that can hit the player and are blocked by barriers due to the simple nature of raycasts. They work well most of the time, but at this point, nothing is communicated to the player. I want to make a wide beam, or at least a series of beams that follow the arc of the raycasts and function the same way, but visually tell the player what is going on. This is the code for some of the raycasts on the object that emitting them.
beamStart = transform.position;
transform.Rotate (Vector3.forward * .5f);
mainBeamDirs[0] = Quaternion.AngleAxis (2, Vector3.forward) * transform.up * -1;
mainBeamDirs[1] = Quaternion.AngleAxis (7, Vector3.forward) * transform.up * -1;
mainBeamDirs[2] = Quaternion.AngleAxis (11, Vector3.forward) * transform.up * -1;
mainBeamDirs[3] = Quaternion.AngleAxis (-2, Vector3.forward) * transform.up * -1;
mainBeamDirs[4] = Quaternion.AngleAxis (-7, Vector3.forward) * transform.up * -1;
mainBeamDirs[5] = Quaternion.AngleAxis (-11, Vector3.forward) * transform.up * -1;
The beams are in yellow and you can see the player hiding behind a barrier.
This is the main issue I am having with my game, so if someone can help me, I can overcome this huge roadblock.
screen-shot-2016-07-18-at-121627-am.png
(94.6 kB)
Comment