[Help] Check where a certain gameobject is inside a mesh collider trigger

Hi I’m working on a swim/dive script using triggers and I’m so close to the end with it, i literally only need to fine-adjust it. Since I’m able to “bounce” on the top of the trigger if i keep going upward, and I found away of avoiding this by using Vector3.Dot(Player.Pos, Trigger.Pos)

But this does not work 100% either, if I was to have a very deep sea, eg, more than 100 units it would restrict me from going further up while I’m (the character) is still completely under water I tried working out a little “hack” to calculate how deep the sea was etc. but still the result was a little weird.

Then i thought if there was anyway of knowing exactly where inside the trigger I was or where the top of the trigger is, I could simply just have a minor offset between the the player and trigger, but im not sure what i should use to detect this, or in general check where is player is in a trigger. any suggestions would be great. Thanks

you can find the top of your trigger with bounds

ooh, Thanks a lot, I’ll look into it :slight_smile:

Edit, Looks good now it’s less than 0.1 it differ in height when entering now so thanks :smile: