Heavily optimise entitylookup (#5400)

* Heavily optimise entitylookup

Previously I made it so MOST of entitylookup goes through the same 4 or 5 codepaths and uses shapes. The downside was some codepaths were made much slower in the process.

This fixes most of the going up and down lookups that some codepaths did. It should also be faster than the pre-shapes version because GetLocalPhysicsTransform is being used for the non-approx queries and most entities are parented directly to their broadphase.

* Tests and confidence

* code

* dang
This commit is contained in:
metalgearsloth
2024-08-27 21:32:50 +10:00
committed by GitHub
parent 6396ec472d
commit cd95929ebe
7 changed files with 478 additions and 102 deletions

View File

@@ -25,6 +25,13 @@ public static class Matrix3Helpers
return a.EqualsApprox(b, (float) tolerance);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Box2Rotated TransformBounds(this Matrix3x2 refFromBox, Box2Rotated box)
{
var matty = Matrix3x2.Multiply(refFromBox, box.Transform);
return new Box2Rotated(Vector2.Transform(box.BottomLeft, matty), Vector2.Transform(box.TopRight, matty));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Box2 TransformBox(this Matrix3x2 refFromBox, Box2Rotated box)
{