OnTrigger Problem

Hi,

After searching the net for possible solutions with no joy, and playing with my project to find a solution with no joy I decided it was time to see if another set of eyes ( hopefully more skilled than mine ) can see what I am doing wrong.

I have a set of planes in a 3 by 3 grid set up named with compass points to ease identification. I have changed their colliders from mesh to box based on recommendations read elsewhere to have a more precise collider boundary. None of these have a rigid body ( tried but it makes them move ) nor set as a trigger ( character always falls through ).

I then have my character as a capsule with a rigid body, capsule collider, character controller and a few control scripts. I have set the collider up as a trigger and the rigid body as using gravity. I have tested with kinematic but read that it should be turned off so have that switched off.

I then have a script that monitors the OnTriggerEnter, OnTriggerExit and OnTriggerStay functions. All it does is display the two colliders that are interacting. If they are the same collider I return without continuing ( how can a collider collide with itself ??? ).

The good news is that it works when the character firsts hits the ground. Sometimes, after a delay it may trigger movement between the first ground tile into the second one but other than that I can move around the ground and not hit a single trigger comment.

The box colliders have a ‘y’ value of 1 and the character has a ‘y’ position of 1 with the collider radius also set to 1 to ensure that it is colliding with the ground at all times.

Is there something else I need to do for this to work consistently.

I am expecting the OnTriggerEnter and OnTriggerExit to display whenever I enter and leave a tile and OnTriggerStay to display if I remain in the same tile but this doesn’t seem to be the case.

Thanks for any assistance to this pain in the butt problem.

Tried another theory out and it worked. Posting here in case others hit this same stumbling block.

Based on the understanding that IsTrigger means that it can be walked through I had put the trigger on the character as I didn’t want to fall through the ground having the triggers on the tiles.

But, seeing as I had the tiles parented to a world empty object I simply place a collider on that, that wasn’t a trigger enabling the character to walk on that rather than the tiles with the visuals on it. It’s collider took up the space for all 9 tiles.

I then set all of the tiles as triggers ( and raised the collider height to 2 ) and attached the script to them and then removed those items from the character.

The character now walks through each tile and hits the 2 high collider every time and triggers the events.