Update debug interaction box drawing

This commit is contained in:
Sezz 2025-01-01 19:15:47 +11:00
parent 01129f62b5
commit 06ee8fa4b8
2 changed files with 21 additions and 3 deletions

View file

@ -331,9 +331,27 @@ void TestForObjectOnLedge(ItemInfo* item, CollisionInfo* coll)
bool TestLaraPosition(const ObjectCollisionBounds& bounds, ItemInfo* item, ItemInfo* laraItem) bool TestLaraPosition(const ObjectCollisionBounds& bounds, ItemInfo* item, ItemInfo* laraItem)
{ {
constexpr auto DEBUG_BOX_COLOR = Color(1.0f, 0.0f, 0.0f);
// Draw oriented debug interaction box.
if (DebugMode) if (DebugMode)
{ {
DrawDebugBox(bounds.BoundingBox.ToBoundingOrientedBox(item->Pose), Color(1.0f, 0.0f, 0.0f), RendererDebugPage::CollisionStats); auto obb = bounds.BoundingBox.ToBoundingOrientedBox(item->Pose);
auto rotMatrix = item->Pose.Orientation.ToRotationMatrix();
DrawDebugBox(obb, DEBUG_BOX_COLOR, RendererDebugPage::CollisionStats);
DrawDebugLine(
obb.Center + Vector3::Transform(Vector3(0.0f, -obb.Extents.y, 0.0f), rotMatrix),
obb.Center + Vector3::Transform(Vector3(0.0f, -obb.Extents.y, obb.Extents.z), rotMatrix),
DEBUG_BOX_COLOR, RendererDebugPage::CollisionStats);
DrawDebugLine(
obb.Center + Vector3::Transform(Vector3(0.0f, -obb.Extents.y, obb.Extents.z), rotMatrix),
obb.Center + Vector3::Transform(Vector3(0.0f, obb.Extents.y, obb.Extents.z), rotMatrix),
DEBUG_BOX_COLOR, RendererDebugPage::CollisionStats);
DrawDebugLine(
obb.Center + Vector3::Transform(Vector3(0.0f, obb.Extents.y, 0.0f), rotMatrix),
obb.Center + Vector3::Transform(Vector3(0.0f, obb.Extents.y, obb.Extents.z), rotMatrix),
DEBUG_BOX_COLOR, RendererDebugPage::CollisionStats);
} }
auto deltaOrient = laraItem->Pose.Orientation - item->Pose.Orientation; auto deltaOrient = laraItem->Pose.Orientation - item->Pose.Orientation;

View file

@ -5,10 +5,10 @@
#include "Renderer/Structures/RendererShader.h" #include "Renderer/Structures/RendererShader.h"
#include "Specific/configuration.h" #include "Specific/configuration.h"
#include "Specific/trutils.h" #include "Specific/trutils.h"
#include "version.h" #include "Version.h"
using namespace TEN::Utils;
using namespace TEN::Renderer::Structures; using namespace TEN::Renderer::Structures;
using namespace TEN::Utils;
namespace TEN::Renderer::Utils namespace TEN::Renderer::Utils
{ {