Hi, ladies and gentlemen,
I’m looking for a way to occlude moving objects when they are not in view. In my case, the moving objects are animated enemies wandering the scene. Using Unity’s built in Occlusion culling system, I did manage to get Occlusion culling working for static objects (terrain and static environmental props/trees/rocks). However, the system fails with moving objects.
My question is, what is the easiest way to implement occlusion culling for moving objects? Do I need to write a system myself or is there a built-in way to achieve it? I have also heard good things about some of the Dynamic OC packages on the asset store, namely this one >> Unity Asset Store - The Best Assets for Game Making
But don’t want to pay for it if there is an easy way to do it myself.
As far as scripting my own occlusion culling system, my idea is to do a raycast from the enemy to the player, and only render the enemy if the ray reaches the player. Other dynamic OC systems do it the other way around, with rays coming out of the camera, but it seems much more efficient to simply have one ray per enemy. This way, I would use unity’s built in OC for static objects, and raycasting for moving objects.
let me know what you think is the best way to proceed.