So I’m not exactly a whiz with physics. I did once write a 2D physics engine which, while being very messy, worked to my needs.
And when I say physics engine, I mean getting a player to jump, fall down with gravity, and land on a surface that was below it’s feet.
It would’ve been extremely easier if I had that 2D ‘physics’ engine to refer to, but due to severe, irreversable stupidity, that small set of code is sitting at a computer desk about 600 kilometers away.
So here is what I have so far. I can move about on an x and z axis, detecting collisions with a cuboid. I can jump on a spot, loose upwards momentum with gravity, fall, and land. I can jump ontop of the cuboid. Observations say that my Y position stops as soon as I am above the cuboid, however, my yBottom variable does change to the correct height when atop the cuboid. I cannot jump from the cuboid, because the Y position is not the same as the yBottom. yBottom is the highest point of geometry at my x/z coordinates.
If you can point out my obvious errors amongst my poorly(?) structured code and help fix my little problem, that would be great!
Thanks