- Home /
Other, solved by OnTriggerEnter
Grid pathfinder and collision detection with OnTriggerEnter
Hi, I've made a grid pathfinder and need to correctly setup whether a cell is blocked or not by a collider.
Bounding boxes are not accurate enough for my purpose since I have some meshes with "holes" that must not block all the cells they are on.
Raycasting seems not to be a good solution either because by design they return false if casting from inside a collider (hence failing to detect cells that are fully inside a collider).
OnTriggerEnter seems to be my best chance, for instance by creating mini-colliders for each of my cells, but because of huge grids (~20,000 cells) I need to find some performance workaround. For instance, I could create mini-colliders for few seconds to detect static meshes, then handle dynamic objects differently. So my question is how to have more control on OnTriggerEnter ? What's the optimal amount of time I should wait for OnTriggerEnter to be called (or not) to declare a "static" cell free ? Only one FixedUpdate frame or more ? Any insight on my issue (or maybe another solution) would be highly appreciated :)
Edit: Ok I've actually tested and it seems I can declare free a cell when entering the second FixedUpdate frame if OnTriggerEnter was not called before. I'll assume this hypothesis is correct and will build my system around it, hoping it is consistent.
Follow this Question
Related Questions
Can Someone help me with this script? 1 Answer
Why would OnTriggerEnter get called, but not OnTriggerExit? 0 Answers
Shooting myself 0 Answers
Unwanted occurence of collision event 1 Answer
onTriggerEnter dosent work 2 Answers