jonathanwallace1111 / jump_land

gravity game
0 stars 1 forks source link

Collision Detection #6

Open justinpanagakis-panstack opened 1 year ago

justinpanagakis-panstack commented 1 year ago

We need a way to detect collision on more complex objects than squares.

jonathanwallace1111 commented 1 year ago

Yes. This was one of the original things I wanted to pick your brain about. It seems like their is a steep barrier to entry once you move beyond vertically aligned boxes. I think SAT (Separating Axis Theorem) was the most doable approach that I found. I don't think SAT does concave shapes, tho. I thought of just using the line intersection formula. Then we could do collision detection line by line. That would be computationally expensive, but we could use a higher level algorithm with border boxes to narrow it down and only do specific collision detection for objects that are relatively close to each other.

justinpanagakis-panstack commented 1 year ago

Yeah, one way we could do it also would be to separate the map into zones and do collision detection within each individual zone, that way there won't be crazy unnecessary checks. To start with we can always just check collision on the player square since that's the only thing moving and interacting anyway.