From 69ee6b0bc60eb0adfeea76bf8def5055173a69a3 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Tue, 29 Sep 2026 17:37:31 -0500 Subject: [PATCH] fix(physics): real shapes for the POI trigger wall and trigger rectangle box The "Clear threat list Trigger Wall" names its physics test\POI_trigger_wall.hkx, which the server only knew as env\POI_trigger_wall.hkx, so it got the 2x2x2 stand in cube and enemies walking past never touched it. Physics assets are now also matched by file name, case blind, and the wall is its measured size (1 x 12.98 x 20.45, base at its origin). "Trigger Rectangle Box" (Trigger_Rectangle_Box.hkx, 8 x 8 x 4) gets its real size too; it was a stand in cube as well. Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/PhysicsComponent.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/PhysicsComponent.cpp b/dGame/dComponents/PhysicsComponent.cpp index 39d67e4ae..cd3a8663e 100644 --- a/dGame/dComponents/PhysicsComponent.cpp +++ b/dGame/dComponents/PhysicsComponent.cpp @@ -1,5 +1,8 @@ #include "PhysicsComponent.h" +#include +#include + #include "eReplicaComponentType.h" #include "NiPoint3.h" #include "NiQuaternion.h" @@ -64,6 +67,11 @@ dpEntity* PhysicsComponent::CreatePhysicsEntity(eReplicaComponentType type) { auto* info = physComp->GetByID(componentID); if (info == nullptr || info->physicsAsset == "" || info->physicsAsset == "NO_PHYSICS") return nullptr; + // The file name alone, in lower case: some assets are named by another folder, or case, than the file has + const auto slash = info->physicsAsset.find_last_of("\\/"); + auto assetFile = info->physicsAsset.substr(slash == std::string::npos ? 0 : slash + 1); + std::ranges::transform(assetFile, assetFile.begin(), [](const unsigned char c) { return static_cast(std::tolower(c)); }); + dpEntity* toReturn; if (info->physicsAsset == "miscellaneous\\misc_phys_10x1x5.hkx") { toReturn = new dpEntity(m_Parent->GetObjectID(), 10.0f, 5.0f, 1.0f); @@ -77,8 +85,13 @@ dpEntity* PhysicsComponent::CreatePhysicsEntity(eReplicaComponentType type) { toReturn = new dpEntity(m_Parent->GetObjectID(), 10.0f, 25.0f, 1.0f); } else if (info->physicsAsset == "env\\env_gen_placeholderphysics.hkx") { toReturn = new dpEntity(m_Parent->GetObjectID(), 20.0f, 20.0f, 20.0f); - } else if (info->physicsAsset == "env\\POI_trigger_wall.hkx") { - toReturn = new dpEntity(m_Parent->GetObjectID(), 1.0f, 12.5f, 20.0f); // Not sure what the real size is + } else if (assetFile == "poi_trigger_wall.hkx") { + // test\POI_trigger_wall.hkx in the CDClient (e.g. "Clear threat list Trigger Wall"), env\ in the client's files: + // a box 1 wide, 12.98 tall from its base and 20.45 deep + toReturn = new dpEntity(m_Parent->GetObjectID(), 1.0f, 12.9755f, 20.45f); + } else if (assetFile == "trigger_rectangle_box.hkx") { + // "Trigger Rectangle Box": a box 8 wide, 8 tall from its base and 4 deep + toReturn = new dpEntity(m_Parent->GetObjectID(), 8.0f, 8.0f, 4.0f); } else if (info->physicsAsset == "env\\NG_NinjaGo\\env_ng_gen_gate_chamber_puzzle_ceiling_tile_falling_phantom.hkx") { toReturn = new dpEntity(m_Parent->GetObjectID(), 18.0f, 5.0f, 15.0f); m_Position += QuatUtils::Forward(m_Rotation) * 7.5f;