Hello Polycount,
actually developing a third character controller in Unity,
one of my actual challenge is to add a functional camera collision/occlusion system.
I already tried two process.
One with sphere casting from character head to camera,
and a second with Raycast from character head to four camera near plane corners and a fifth ray from head to behind the camera position.
And for both systems, when something is between character and camera and stop the sphere or ray cast, the camera move forward to a position where she is no more occluded.
After some search about this subject, I didn't find really good technical trick, so yes I understand that a camera collision/occlusion system is not an easy things to do.:(
I really understand the theory, but in practice it is an other story.
But maybe there are other better system or more easy process ?
What is for you the best/more easy ?
Or just do you have more info about these in-game systems ?
Replies
follow camera collision
in fact I try to implement the system explain in a chapter of "Game programming Gems 4" book, with sphere casting from player head to camera, and it works pretty well expect that I have one problem.
When the player is really near some walls, the camera move forward to character and when she is at the head position like a FPS, she go back through the wall and I don't know why.
It's a little hard to explain so I post my C# script.
https://dl.dropboxusercontent.com/u/29714084/TP_CtrlCam_V2.cs
I hope that there is a solution to this problem.
I also found gamedev.net.
And I found by myself an early solution, but I posted anyway on Unity community forum.
Thanks a lot.
Good afternoon.