Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace BepuPhysics with simple collision checks #255

Merged
merged 4 commits into from
Jul 19, 2021

Conversation

enteryournamehere
Copy link
Member

@enteryournamehere enteryournamehere commented Jul 19, 2021

This PR replaces Uchu.Physics with a new implementation, using some simple math instead of BepuPhysics to detect collisions.

  • Collision checks between a box and a sphere, and between two spheres, are actually correct now. From what I saw during testing, the old method used an axis-aligned bounding box for any shape, resulting in inaccurate trigger areas.
    • Collision checks between two boxes only check whether any of the vertices are in the other shape, so edge-edge collisions aren't detected. However, this kind of collision is relatively rare, and it'll most likely still result in a vertex-face collision a bit later. Additionally, this function isn't actually needed at the moment - there's currently no box object that should be able to collide with other box objects.
  • Although bepuphysics is very fast, this is faster, taking 0ms for Ninjago Monastery where the old code took 2 to 5 ms.
  • Removed CylinderBody and CapsuleBody, added SphereBody. (Player is now seen as a sphere with radius 2 instead of as a capsule.)
  • Fixed some inaccuracies in the SetPhysicsByPath function.

I've also added a script for death planes in Venture Explorer, which is finally possible now that the collisions are accurate 🎉

@enteryournamehere enteryournamehere merged commit cb91d81 into dev Jul 19, 2021
@enteryournamehere enteryournamehere deleted the refactor/physics branch July 19, 2021 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant