itch.io is community of indie game creators and players

Devlogs

How the lights work (Marin)

City of Abominations (2021)
A downloadable game for Windows and macOS

Hello and welcome to another tutorial for how to set things up in Unity.

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.

Download City of Abominations (2021)
Leave a comment