I want to make a script that uses the OnBecameVisible/Invisible to control the roof fans of my level. When I turn and see the fan I want it to be activated but only if the fan is not occluded by a wall or something. Is there a way to verify if an object is totally visible by the main camera? Thanks any help! =]
asked Jul 16 '12 at 05:36 PM
If you are using Occlusion Culling (Pro only), using Renderer.IsVisible may well work.
If not you would have to do multiple rayCasts towards your fans and determine if they were hit or not, using your walls/obstacles in the Layer Mask.
answered Jul 16 '12 at 05:41 PM