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.
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.
[Please log in to post a comment]