How the lights work (Marin)
Hello and welcome to another tutorial for how to set things up in Unity.
Lighting is always tough, but since we're dealing with a 2D, top-down game, lighting is a bit stranger to implement. To start, a light needs to be shown above the plane (which is all we see) and moved accordingly. To give it a nice enough radius, I have the lights here set to be -3.5 in the Z-axis (depth).
Now as you might see, that green circle is our collider. However, that light is in a 3D space, vs our 2D. So the collider is instead a child object. Why even use a collider, why can't we just raycast this whole thing? Well, if we were to directly raycast if the light hits our player, then it'll only take the center of the light (which in this case is that blue arrow) into account, and just trying to figure out the math to account for the radius otherwise would be too much. We only want that small, green area. We also needed that collider to be directly on the plane, and unfortunately, Unity doesn't really allow for movement of a collider on an object other than scaling.
Should we move the light closer or further away, we will see a change in the intensity and radius, both for the lighting and collider (which we need to change manually).
That being said, the spot light here will be made into a prefab, to be instances where and however, to make the lives of the level designers (and probably engineers) easier.
Get City of Abominations (2021)
City of Abominations (2021)
How will you control your bloodlust?
Status | Canceled |
Author | Precipice Games |
Genre | Action |
Tags | 2D, Action RPG, Dungeon Crawler, Perma Death, Pixel Art, Singleplayer, Top-Down |
Languages | English |
Accessibility | Subtitles |
More posts
- KM Devlog 2May 28, 2021
- KM Devlog 3May 28, 2021
Leave a comment
Log in with itch.io to leave a comment.