Slopes is the main reason I have for pondering the grounded state’s use of gravity. Although my original question was more vague and open, since this was something I haven’t thought of before and was curious to cross reference with people. However, if there are a plethora of issues that occur as a result or can be solved by one or the other, that’s what I’m most open minded about.
What you explained in your previous post seems like it’s worth a go. The goal for my slope implementation is to be more akin to Super Mario/Mega Man-like slopes in simplicity, but the way collisions work in my game seems to make it less than simple. What I mean by that is:
The way the collision physics works now is that I have my horizontal and vertical displacements separate: horizontal collisions only horizontally displace and vertical collisions only vertically displace. But slopes would [be able to] displace on both axes.
In what I’ve made so far, some game object types can stack on top of each other in a parent/child tree. So with this stack of objects: gravity is applied to the parent -> then it’s corrected by collision. Then we go through the children in order from bottom to top -> displace according to parent -> apply gravity to ensure we’re attached to parent -> correct by collision.
Now the child at the tippy top hits the ceiling. This affects the whole stack all the way down to the parent. I correct the children from top to bottom, with the parent coming last. Now this is easy with how I separate horizontal and vertical displacement, but if this stack of objects would be on a slope then they would all need to be adjusted along the slope.
I do wonder though if not applying gravity could potentially remove 1-2 physics steps when that top child hits the ceiling. Take for example that same instance but the top child doesn’t hit the ceiling until the 2nd physics step: In the 1st step gravity pushes him towards the parent (so he doesn’t collide with ceiling) -> then it’s corrected -> then in the 2nd step he now collides with the ceiling -> now push everything back down and maybe do a 3rd step.
If removing this potentially expensive (for CPU) hurdle can be done without breaking or making other things challenging to properly implement, then it may have its merits.
I watch a lot of GDC and other talks about game design and programming in general. So when I saw Jon Blow saying that it was preferable to not apply gravity while grounded (and move along the surface normal) I thought, “Wait is this the standard? Have I not been in the loop?” And I’m still not sure.