From 0a1af644af214597956e414b00c872671ba6738a Mon Sep 17 00:00:00 2001 From: unelsson Date: Tue, 28 Mar 2023 16:12:23 +0300 Subject: [PATCH 1/3] Make empty collision shape for objects without any triangles. --- components/resource/bulletshapemanager.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/resource/bulletshapemanager.cpp b/components/resource/bulletshapemanager.cpp index 004c772e42..da0354104f 100644 --- a/components/resource/bulletshapemanager.cpp +++ b/components/resource/bulletshapemanager.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -77,6 +78,19 @@ namespace Resource if (!mTriangleMesh) return osg::ref_ptr(); + if (mTriangleMesh->getNumTriangles() == 0) + { + osg::ref_ptr shape(new BulletShape); + mTriangleMesh.reset(nullptr); + auto emptyShape = std::make_unique(); + shape->mCollisionBox.mExtents[0] = 0.0f; + shape->mCollisionBox.mExtents[1] = 0.0f; + shape->mCollisionBox.mExtents[2] = 0.0f; + shape->mCollisionBox.mCenter = osg::Vec3f(0, 0, 0); + shape->mCollisionShape.reset(emptyShape.release()); + return shape; + } + osg::ref_ptr shape(new BulletShape); auto triangleMeshShape = std::make_unique(mTriangleMesh.release(), true); From e19a3e07aa177b4fc8dacd0e9da07b6e6a08f7c3 Mon Sep 17 00:00:00 2001 From: unelsson Date: Tue, 28 Mar 2023 16:14:34 +0300 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a33fcd53c5..03a5cee139 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Bug #7044: Changing a class' services does not affect autocalculated NPCs Bug #7054: Quests aren't sorted by name Bug #7064: NPCs don't report crime if the player is casting offensive spells on them while sneaking + Bug #7077: OpenMW fails to load certain particle effects in .osgt format Bug #7084: Resurrecting an actor doesn't take into account base record changes Bug #7088: Deleting last save game of last character doesn't clear character name/details Bug #7092: BSA archives from higher priority directories don't take priority From 3d4da02b18941462211903e5db4210561e7e61a4 Mon Sep 17 00:00:00 2001 From: unelsson Date: Tue, 28 Mar 2023 23:54:26 +0300 Subject: [PATCH 3/3] Don't mess around with btEmptyShape. Use nullptr instead. --- components/resource/bulletshapemanager.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/components/resource/bulletshapemanager.cpp b/components/resource/bulletshapemanager.cpp index da0354104f..c2d38e164d 100644 --- a/components/resource/bulletshapemanager.cpp +++ b/components/resource/bulletshapemanager.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include @@ -75,22 +74,9 @@ namespace Resource osg::ref_ptr getShape() { - if (!mTriangleMesh) + if (!mTriangleMesh || mTriangleMesh->getNumTriangles() == 0) return osg::ref_ptr(); - if (mTriangleMesh->getNumTriangles() == 0) - { - osg::ref_ptr shape(new BulletShape); - mTriangleMesh.reset(nullptr); - auto emptyShape = std::make_unique(); - shape->mCollisionBox.mExtents[0] = 0.0f; - shape->mCollisionBox.mExtents[1] = 0.0f; - shape->mCollisionBox.mExtents[2] = 0.0f; - shape->mCollisionBox.mCenter = osg::Vec3f(0, 0, 0); - shape->mCollisionShape.reset(emptyShape.release()); - return shape; - } - osg::ref_ptr shape(new BulletShape); auto triangleMeshShape = std::make_unique(mTriangleMesh.release(), true);