Super Simple Object Culling

This is a little trick from a prototype I was working on ages ago. Essentially there was a character that moved around an environment and attacked enemies. The problem was he sometimes got obscured by the environment. As it was a prototype, I made the quickest and dirtiest thing I could and whacked it in.

As the diagram shows above I raycasted from the camera to the player character. If the raycast hits anything marked “Obstacle” or equivalent term the object is deactivated.

This is SUPPPEEERRR basic. There are some cleverer things you can do like do a box cast and seeing how much an object is inside the box cast and fade it out, but if you need to get something up and running quickly then this is a quick and dirty implementation.

Leave a Reply

Your email address will not be published. Required fields are marked *