Slope detection and other geometry adventures

Well, the good news is that I'll probably be releasing a simpler 2D library for BGT, since geom is complex, the documentation is hard to read, and transformations/polygon collision don't always work correctly.

I want to use this in a game with less flat terrain than we generally have in Audio Games, though, for which I'm running up on some confusion.

What I have so far works with rectangles, convex polygons, and regular stars. I can add circles easily enough.
What I need to be able to do is, when one object (let's call it Object A) collides with another object (call it Object B), determine if Object A is landing on an up-facing section of Object B.
(Bonus points for a solution that works when "up" is relative to Object A, enabling loops and running up walls and junk.)

Let's use the example of the player (with a rectangular bounds, for simplicity's sake) hitting a cliff (represented by a scalene triangle). If the p layer hits the left side of the cliff from above, or from another surface that touches the bottom corner, they walk on the incline.
If the player lands on top of the cliff, it's a flat surface, so all we care about is if we're on the correct side of the line.
If the player hits the right side, they're coming at it from below. Unless there's some interesting inclines under the cliff, there's no way they're walking there.

If the cliff is floating in mid air, though, it's possible to hit that bottom left corner from a bad angle.
For that matter, the right corner of the cliff is exposed, so we need to distinguish between landing on it from above, and bumping into it from some other angle.

This all makes wonderful sense verbally, but I'm kinda confused on how to get a computer to do it.
Just using tiles with solidity and angles would be much simpler, I'm sure. That was my original plan, after all. I'm not s ure I can use that model anymore, though.

(For that matter, I'll probably want to modify sound_pool to support arbitrary shapes instead of just rectangles. What joy.)

So... uh... any ideas on how to determine if A is hitting something it can land/stop/slide/etc on?

(If I figure this out within five minutes of posting... my probability for a demon that really doesn't want me finishing anything goes up by at least 1.25x.)

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Genroa via Audiogames-reflector

Reply via email to