I’ve been optimizing my ledge hang in my project and I had a few ideas to handle the ledge positioning. I think I’ll include a picture to make it easier to understand.
That’s how I want to position my player on the ledge. The way I’m doing this current is using an empty I place at the height of the ledge. I use its z position to set my player’s z position. This solution is horrible though. It requires more setup and its not flexible. Not all ledges are perfectly flat.
So I’ve been thinking. Using the rayCast method on KX_GameObjects actually returns information on the polygon it’s hitting (or at least that’s what I understand from its API documentation). So I’ve been thinking that using this information would allow me to get the position of the highest vertex’s world position. So instead of using an empty as a Z-position reference, I’d use the vertex’s world position as the Z-position reference.
I actually don’t know how to do this, and I don’t even know whether it’s possible but can someone help me out with this?
Is there a better way to get the Z-position of the ledge?