|
Post by DarkKobold on Nov 18, 2019 22:05:12 GMT
On this topic, does anyone know a good algorithm for diagonal hitboxes? Diagonal hit boxes? You mean diagonal parts for background collision? No, I think I know how to do that. This is like, Square enemy vs. a whip attack that goes up+right. My current thinking is breaking it into 4 or 8 square segments, but I'm just wondering if there's some algorithm people figured out to do diagonal hitboxes really efficiently.
|
|
|
Post by turboxray on Nov 18, 2019 22:36:31 GMT
So not just the "head" of the whip needs to account for collision detection? Some games only do the end of the whip. But if you need most of the whip, it'd probably be faster to have a few boundary regions along the whip than to do line intersection detection on the PCE (unless you absolutely need that kind of precision). I recommend having multiple small boundary boxes, but make then tiny and don't connect them edge to edge. Space them out so you need fewer. Think of the gap between them.. make it like unit less in width than your smallest known collision box (that interacts with this group of boxes). Or something along those lines. Maybe you can get away with just using three? One for the end of the whip and two in between spaced out? I'd have to know some more aspect to give you a more detailed answer, but yeah a few intermediate collision boxes with maximum size gap between them (diagonal gap).
|
|
|
Post by dshadoff on Nov 18, 2019 23:34:53 GMT
When I implemented collision detection on my first game back in 1982, I found that the easiest way was to do exactly that: gross-level (i.e. character block) detection, followed up by fine-level elimination. It helps if your graphics are regularly-shaped.
|
|
|
Post by Arkhan on Nov 19, 2019 1:07:53 GMT
en.wikipedia.org/wiki/Bresenham%27s_line_algorithmGITCHU SUM Use this to decide on how many bounding boxes to splat out. Though, given how fast a whip attack is probably moving, I'd guess you can probably do just the tip (hahhh), and save yourself alot of hassle.
|
|