Log In  

Cart #21913 | 2016-05-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

After debugging some physics issues in PICORACER-2048 I decided to make a little area to play around with improving the physics and collisions.

I'm using the "Separating Axis Theorem" to find collisions, and clipping to find the contact points.

Lots of work to do still, many optimisations can be made.

Known issues: contact points are sometimes broken, collision response is not always right.

Optimisations to make:

  • cache AABB
  • cache world polygons
  • don't check AABBs that are not in the same area
  • don't check equivalent axes more than once
  • remember the previous axis since it's likely to be the same or next to it on the next iteration.
P#21915 2016-05-31 10:51 ( Edited 2017-09-19 01:56)

Cool! Would it be hard to code it to be general-purpose physics library for pico? Also why not use circle and square collisions when possible as additional optimizations? Some of the shapes in the playground are approaching circles so player wouldn't notice much of a difference if it would be check against circle of specific radius.

P#21974 2016-05-31 19:07 ( Edited 2016-05-31 23:07)
:: impbox

Well it's effectively a general-purpose physics library for pico (once the bugs are fixed).

Yes, I plan to add in circle-circle collisions and circle-convex polygon collisions.

P#21995 2016-05-31 21:28 ( Edited 2016-06-01 01:28)
:: matt

Awesome work

P#22021 2016-06-01 05:28 ( Edited 2016-06-01 09:28)

Very nice!

P#44334 2017-09-18 21:56 ( Edited 2017-09-19 01:56)

[Under spam review]

P#75291 2020-04-24 14:24

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-04-20 03:14 | 0.023s | 2097k | Q:34