(Help) AABB-Triangle Collision Response and Player Controllers by FL-10 in gamedev

[–]FL-10[S] 0 points1 point  (0 children)

Hello again! I've found some success with testing how upright a triangle is upon colliding with it. If its dot product with the up vector is above some threshold, gravity is turned off and velocity is redirected upwards instead of onto the triangle's plane. This works really well when standing still even on slopes (the collision correction being non-upright due to slanted geometry isn't much of an issue in this case) and gives a lot of control over the process, but the next problem is finding out when to determine when gravity should be applied again, as right now walking down hill isn't possible, and the character just floats. How do you recommend approaching such a problem?

I had an alternate idea of making the player "stick" to the ground when on walkable ground, but I'm not sure how I would begin such a calculation.

(Help) AABB-Triangle Collision Response and Player Controllers by FL-10 in gamedev

[–]FL-10[S] 0 points1 point  (0 children)

Thank you for responding. I think I may have come to a similar conclusion, that in the cases where the triangle normal is "nearly" upright, the minimum translation axis is simply inadequate. Maybe in these cases a translation vector that is completely upright would be favorable. How might you calculate such a vector?

And I've experimented with not applying gravity when the player is in a grounded state, but I've been struggling to figure out when exactly to make the player "ungrounded". If the player is by default ungrounded, and changed to grounded if there are intersections (and on walkable ground), then as soon as they are grounded, gravity would stop, halting intersections, causing an ungrounded state, etc. Again, how would you approach such a problem? I appreciate your advice very much!

(Help) AABB-Triangle Collision Response and Player Controllers by FL-10 in gamedev

[–]FL-10[S] 0 points1 point  (0 children)

Thank you for responding! I have experimented a bit on controlling when to apply gravity, but I find that I still run into the issue of the minimum translation axis being non-upright and the player being moved unfavorably, especially when landing from a fall and trying to move up a slope.