Back to Browse

Unity C# Detect Object Between Camera and Player then Move Closer

343 views
Mar 18, 2025
1:04

Hello guys. I have three objects on this scene. A camera, capsule and a cube. If I run the game and move this cube and place it between the player object, which is the capsule, and the camera, nothing happened. But let me activate this script, that detect an object between camera and player then moves the camera closer. As you can see, whenever an object is detected, the camera will move closer to the player. If you are interested to use this script, get the link in the description of this video. That's all for this video. Thank you and see you soon. Get the script from my blog: https://thirteenov.ciihuy.com/unity-c-third-person-camera-occlusion-script/

Download

0 formats

No download links available.

Unity C# Detect Object Between Camera and Player then Move Closer | NatokHD