efficient camera-object culling for visibility

Hello friendly forum:

I have a 3rd-person game with a camera that follows the character. Because the camera is player-controllable, it’s possible to swing it behind/through objects that will obscure the player during play. My solution for this was to cast a ray from the camera to the player, and if the ray hits anything but the player, the object is faded out.

Now, I am concerned about performance. Should I be? The game is not complex and does not have a great deal of geometry or detail. Raycasting is also not a hugely-expensive function, and I’ll be putting tags on the objects allowed to cull so my raycast isn’t assessing the entire scene.

So basically I wanted to see if I was going about this the right way. Are there better alternatives?

Thank you for your collective and more experienced assessment of my approach!

This should work fine, especially if your game is really simple. Here is a video tutorial with a lot of information on making a 3rd person camera, they do it with ray casting, but i think they cast the ray from the character to the camera. Check it out http://www.3dbuzz.com/vbforum/content.php?212

Perfect! I love 3D Buzz, those guys are really helpful.

Thanks very much for the reply. :slight_smile: