# Simulate light ray hitting wall

**URL:** <https://forum.kirupa.com/t/simulate-light-ray-hitting-wall/329129>\
**Category:** programming\
**Created:** [July 24, 2012, 10:18am UTC](https://forum.kirupa.com/t/simulate-light-ray-hitting-wall/329129 "2012-07-24T10:18:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![santanoa](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@santanoa](https://forum.kirupa.com/u/santanoa)\
**Post date:** [July 24, 2012, 10:18am UTC](https://forum.kirupa.com/t/simulate-light-ray-hitting-wall/329129/1 "2012-07-24T10:18:42Z")

</div>

[COLOR=#000000][FONT=verdana]I’m trying to simulate a light ray (which you can assume is just a rotated rectangle) hitting a wall (another rectangle, also could be rotated). I’ve gotten the collision detection working, but am not sure how to make the light ‘stop’ when it hits the wall. How would I ‘cut off’ the part of the light ray which is past the wall and only leave the first part visible? [/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]Maybe something to do with masks, but I’m clueless.[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]Thanks![/FONT][/COLOR]
