Draw interaction box in collision stats debug page

This commit is contained in:
Sezz 2024-12-24 13:13:45 +11:00
parent c757422f2d
commit 96f41ef9e8

View file

@ -330,6 +330,8 @@ void TestForObjectOnLedge(ItemInfo* item, CollisionInfo* coll)
bool TestLaraPosition(const ObjectCollisionBounds& bounds, ItemInfo* item, ItemInfo* laraItem)
{
DrawDebugBox(bounds.BoundingBox.ToBoundingOrientedBox(item->Pose), Color(1.0f, 0.0f, 0.0f), RendererDebugPage::CollisionStats);
auto deltaOrient = laraItem->Pose.Orientation - item->Pose.Orientation;
if (deltaOrient.x < bounds.OrientConstraint.first.x || deltaOrient.x > bounds.OrientConstraint.second.x ||
deltaOrient.y < bounds.OrientConstraint.first.y || deltaOrient.y > bounds.OrientConstraint.second.y ||
@ -341,11 +343,7 @@ bool TestLaraPosition(const ObjectCollisionBounds& bounds, ItemInfo* item, ItemI
auto pos = (laraItem->Pose.Position - item->Pose.Position).ToVector3();
auto rotMatrix = item->Pose.Orientation.ToRotationMatrix();
// This solves once for all the minus sign hack of CreateFromYawPitchRoll.
// In reality it should be the inverse, but the inverse of a rotation matrix is equal to the transpose
// and transposing a matrix is faster.
// It's the only piece of code that does it, because we want Lara's location relative to the identity frame
// of the object we are test against.
// NOTE: Transpose = faster inverse.
rotMatrix = rotMatrix.Transpose();
pos = Vector3::Transform(pos, rotMatrix);