Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Utils/ActorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Util

RE::bhkRigidBody* bhkRigid = collisionObj->body.get() ? collisionObj->body.get()->AsBhkRigidBody() : nullptr;
RE::hkpRigidBody* hkpRigid = bhkRigid ? skyrim_cast<RE::hkpRigidBody*>(bhkRigid->referencedObject.get()) : nullptr;
if (bhkRigid && hkpRigid) {
if (bhkRigid && hkpRigid && !skyrim_cast<RE::hkpListShape*>(hkpRigid)) { // Ignore hkpListShape, unsupported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Test the change and consider adding logging.

The logic correctly skips hkpListShape by checking that the cast returns nullptr. However:

  1. Testing required: The PR is marked as untested. Collision handling changes need verification to ensure objects with hkpListShape don't lose collision entirely or cause other regressions.

  2. Observability gap: Consider logging when shapes are skipped to aid debugging. Users or developers troubleshooting collision issues won't know if hkpListShape was encountered and ignored.

📋 Suggested improvement: Add logging
-	if (bhkRigid && hkpRigid && !skyrim_cast<RE::hkpListShape*>(hkpRigid)) {  // Ignore hkpListShape, unsupported
+	auto* listShape = skyrim_cast<RE::hkpListShape*>(hkpRigid);
+	if (listShape) {
+		// hkpListShape is unsupported; proper parsing of child shapes not implemented
+		logger::debug("Skipping unsupported hkpListShape in collision bounds calculation");
+		return false;
+	}
+	if (bhkRigid && hkpRigid) {

Please verify this change doesn't cause collisions to fail for actors or objects that commonly use hkpListShape:

#!/bin/bash
# Search for any existing hkpListShape handling or references in the codebase
rg -n -C3 'hkpListShape' --type=cpp
#!/bin/bash
# Check if there are tests for GetShapeBound or collision handling
fd -e cpp -e h test | xargs rg -l 'GetShapeBound|ActorUtils' 

RE::hkVector4 massCenter;
bhkRigid->GetCenterOfMassWorld(massCenter);
float massTrans[4];
Expand Down