Unity Raycasting Reflections

Okay, so, Unity is kind of a pain, but I did manage (with lots of help and the use of a pretty good tutorial hereĀ http://www.41post.com/4162/programming/unity-raycast-reflection) manage to put together something that I want.

http://www.johnalatouf.com/testing/LightPuzzleTest.html

There are still some bugs. For one thing, the way to select the mirrors is stupid right now, but that’s fixable. You have to click and remain hovering over them with the mouse, then spin them using the left and right keys. More concerning is the fact that when I have two beams hitting one mirror, the first reflection beam is replaced with the new reflection. It shouldn’t do this. I guess it should display both? I don’t know, that might just be annoying. I’ll think about it.

Still Here

I have spent the last few days doing Unity tutorials. I’m trying to do some annoying things with Unity’s RayCast that may or may not be possible. I’m trying to make a simple laser reflection game. A RayCast is emitted from a light source area and then when it hits another object it draws a line using LineRenderer to reflect from that object. Ideally, it should continue reflecting along objects that you can turn untilĀ it touches an end point.

I found a tutorial online that makes the RayCasts reflect on a set number of objects and then draws one long lineRenderer. This isn’t quite what I want, as I need to be able to adjust the number of reflections differently and I will need to use separate LineRenderers probably, but it’s a start. I am working towards getting the separate LineRenderers working, and then I’ll try and fit them into a loop of some sort. We’ll see.