Problem with Collider trigger

I’m working on a 3rd person shooter

currently working on camera collision detection

I began by doing raycasts from the main cam to 4 locations and if any of the 4 came back with a hit lerping the camera forward until the raycasts came back clean

(my 4 points were just left of the player, and a mirrored point on the right of center, one in center, and one above center, basically ensuring that the core gameplay area from around players waist to just over his head was always clear)

i began this process and while I’m 100% that this will work i thought that’s a lot of raycasts to be doing all the time, so i wanted to trim it back some, my solution was to put a collider between the camera and player essentially covering the same area, making the collider a trigger, and then running the raycasts only when the collider was being triggered. I thought this would be a pretty simple process, but for some reason my collider doesnt seem to want to trigger

in a little demo level i put up a couple walls, a tree and some cubes and ran around, nothing was triggering the trigger event for the collider, then I took one of the cubes and set it to continuous detection and it worked… so the code works, but for some reason it is only recognizing the ontriggerenter when continuous collision detection is set, and since I dont not want to set every object in every level to continuous detection this isnt much of an option

has anyone ran into this before, or does anyone have any ideas why discrete detection will not work but continuous will?

on a whim i tried changing the event to ontriggerstay and oncollisionenter and they didnt seem to make any difference.

Thanks ahead of time for any input.

also if anyone has a good example or alternate solution for a non-performance heavy 3rd person camera collision method please let me know, I’m completely open to suggestions

I wouldn’t sweat doing 4 raycasts per frame. Raycasting does not have a whole lot of overhead, and you can read a small discussion about it here.

To answer your collider question, I’m not sure why it wouldn’t be working. Does your collider (the one between the player and camera) have a rigidbody attached? In order for OnTrigger messages to be sent, one of the two colliding objects should have a rigidbody (ideally the one that’s moving around).

the collider does not have a rigid body but the cubes and such that i’m testing against do

Try switching to OnTriggerStay to see if anything gets called. Either way, I made this post a couple hours ago that has a script you can just attach to the collider to see if it’s working, without any outside interference.