This week marked the start of the second rapid ideation session. The theme announced this week sparked great excitement. Among the several themes to choose from, the one I decided to work with was “rework”. With this theme we were expected to take an existing artefact, and modify or “rework” it into a new form.
I decided to take this opportunity to revisit a game I had made earlier this year during a small game jam event. The game was called “Mirror Maze” and saw the player turning mirrors in order to bounce a laser through the level to hit a target. I wanted to see if I could take this concept and convert it from 2D, to 3D. Recently I have been brushing up on my vector math, so I wanted to take this into account in the session. I decided to add the additional challenge of realistically reflecting the laser off the mirrors surface.
As with the last session I decided to use SMART to evaluate my goals for this session
- S – Beam Reflection.
- M – The ray should realistically reflect off the mirrors surface.
- A – Using Vector math and Rays within Unity.
- R – I want to further my knowledge of Vector math and usefully apply it.
- T – The First Week of the Rapid Ideation Session.
- S – 3D ‘Mirror Maze’
- M – The final artefact should mimic aspects of ‘Mirror Maze’s gameplay in a 3D environment.
- A – Using the Unity game engine and C# scripting.
- R – To fit the constraints of this sessions theme.
- T – The second week of the Rapid Ideation session.
I started off by creating some mirror objects in Unity. I did this by applying a texture to a surface, that would display the feed of a camera placed slightly behind the mirrors surface. I then mimicked a mirror effect by simply facing the camera at the player, then flipping it’s rotation on the y-axis.
Once I was happy with the mirror effect I moved on to the lasers. I started off by creating a script which cast a ray, visualised by a line renderer, this was to act as my “laser”. I then made it so whenever the ray collided with a mirror object, it would “bounce” itself in the direction of the collisions normal, repeating the process were it to encounter another mirror.
After the foundation of the laser script was completed I began researching the math I’d need to create my final desired effect. I quickly came across Stackoverflow entries and other blog posts that simply dropped the code in front of me that would get the job done, but I wanted to look deeper and get a proper understanding of the formulae I was working with. The most useful source I found was a video demonstration by Jorge Rodriguez titled ‘Math for Game Developers – Vector Reflections’ (Rodriguez 2021).
Once I felt I had a strong enough understanding of the underlying math, I moved back into Unity and started adapting my laser script to properly reflect the incoming ray, as I had originally planned. It took some time but I eventually got the effect working to a level I was happy with.
At this point I had completed the my first task and was feeling pleased and motivated heading into the second week.
- McConnell, Evan. 2021. “Mirror Maze By Oscail”. itch.io [online]. Available at: https://oscail.itch.io/mirror-maze [accessed 4 Nov 2021].
- RODRIGUEZ, JORGE. 2021. Youtu.be [online]. Available at: https://youtu.be/naaeH1qbjdQ [accessed 15 Nov 2021].