mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Draw interaction box in collision stats debug page
This commit is contained in:
parent
c757422f2d
commit
96f41ef9e8
1 changed files with 3 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue