Improved collision filter test#6431
Improved collision filter test#6431eoineoineoin wants to merge 1 commit intospace-wizards:masterfrom
Conversation
moonheart08
left a comment
There was a problem hiding this comment.
Tentative approval, I'm iffy on the idea of encouraging people to do physics checks without a real entity, but the logic looks fine. Please double-check your logic in-game if this code path doesn't have any tests.
Pretty confident that it's equivalent - have written a few physics engines in my time :). Robust.Shared.Tests/Physics is pretty light on tests, but happy to write some if you like? The code before was effectively doing: So I'm just transforming this to get rid of the n^2 loop, by combining all the layers/masks and testing them once: |
Minor improvements to collision filter test:
SharedPhysicsSystem was doing an O(n*m) test for every possible fixture pair when testing two FixturesComponents for collision. But because it's not doing any narrowphase collisions, the same result can be calculated in O(n+m) steps, just by summing up the collision layers/masks.
Added an interface to check IsHardCollidable() using just the fixtures components. I wanted this when checking collision with an EntityPrototype, so didn't have an Entity yet.