How can I make a third person camera collision script?
How can I make a third person camera collision script? I have the actual Third Person Camera part working but I need to stop the camera from traveling through certain tagged objects. At the moment I have been using raycasting but it is unreliable when you swing the camera to fast into an object. Once the camera is inside the object, the raycasting no longer works. I have tried the OnCollisionEnter syntax but it doesn't work. Plus the objects do not have rigidbodies on them. Please help.
P.S. I do not want to have to redo my third person script and I do not mind of the camera collision syntax is in a totally different script file. It must work with Mesh Colliders
Answer by y0kkaboom · Oct 19, 2018 at 09:19 AM
Is it necessary in a script? You could put a collider on your Camera, and then assign it to the right layer then in the physic settings make it collide only with the objects you want? Hope i'm helping ...
Answer by UnityCoach · Oct 19, 2018 at 02:02 PM
Why not use Cinemachine? They've figured this all out. Target following, target group follwogin, look at, confinement, collisions, you name it.
Do you have any recommendations for where to learn how to use Cinemachine (e.g. a YouTube channel)?
The documentation and examples will give you a good start. It's pretty straightforward to use.