I've performed partitioning of my level into broad and narrow phase. I'm down to narrow phase and focusing on the height from the ground.
I want to see what polygon the player is on top of. Since some polygon sectors may be lower than others (this is a birds eye view), I want the player to be stand on top of the highest one. Therefore I thought what I can do is each game tick would be to check which boxes the player intersects, and then find the polygon with the highest 'height' and use that as the base height for the player.
An example would be below:
Is this a viable way of doing it? That this game is 3D, but I only have to do two dimensional calculations for the height which reduces the computation and makes this easier.
The level has been cut up into a BSP tree so the following is a gross misrepresentation of the level, however I don't see any obvious way (immediately) to exploit the BST property to find out the highest sector that the player would be standing in. So far the best way I could think of was to use narrow phase collision detection described above and hope that is extremely fast.
I am looking for speed here, so if you know of any better algorithms or some faster way of doing this, please let me know.
EDIT: The focus of this post is for high level algorithms, of which they can be optimized later on. No actual collision detection code has been made yet.