summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorHoward Stearns <howard.stearns@gmail.com>2022-05-10 14:57:24 -0700
committerHoward Stearns <howard.stearns@gmail.com>2022-05-10 14:57:24 -0700
commit7565e734d29112e14e885a6097805c1315b81917 (patch)
tree9921a0f34794af3b6494a0d5740374606420de0d /indra
parentbb8bcce96e20599fc893c2877f3e08047ede6e1e (diff)
SL-2243 - match server physics shape calculation re mesh dimensions
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llphysicsshapebuilderutil.cpp13
-rw-r--r--indra/newview/llphysicsshapebuilderutil.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/indra/newview/llphysicsshapebuilderutil.cpp b/indra/newview/llphysicsshapebuilderutil.cpp
index 5bfe5c9941..9603ee6329 100644
--- a/indra/newview/llphysicsshapebuilderutil.cpp
+++ b/indra/newview/llphysicsshapebuilderutil.cpp
@@ -29,7 +29,7 @@
#include "llphysicsshapebuilderutil.h"
/* static */
-void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumeParams& volume_params, const LLVector3& scale, PhysicsShapeSpecification& specOut )
+void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumeParams& volume_params, const LLVector3& scale, PhysicsShapeSpecification& specOut)
{
const LLProfileParams& profile_params = volume_params.getProfileParams();
const LLPathParams& path_params = volume_params.getPathParams();
@@ -191,6 +191,7 @@ void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumePara
if ( volume_params.shouldForceConvex() )
{
+ // Server distinguishes between convex of a prim vs isSculpt, but we don't care.
specOut.mType = PhysicsShapeSpecification::USER_CONVEX;
}
// Make a simpler convex shape if we can.
@@ -199,6 +200,16 @@ void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumePara
{
specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
}
+ else if (volume_params.isMeshSculpt() &&
+ // Check overall dimensions, not individual triangles.
+ (scale.mV[0] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE ||
+ scale.mV[1] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE ||
+ scale.mV[2] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
+ ) )
+ {
+ // Server distinguishes between user-specified or default convex mesh, vs server's thin-triangle override, but we don't.
+ specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
+ }
else if ( volume_params.isSculpt() ) // Is a sculpt of any kind (mesh or legacy)
{
specOut.mType = volume_params.isMeshSculpt() ? PhysicsShapeSpecification::USER_MESH : PhysicsShapeSpecification::SCULPT;
diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h
index bd5b7d799c..b3b100296f 100644
--- a/indra/newview/llphysicsshapebuilderutil.h
+++ b/indra/newview/llphysicsshapebuilderutil.h
@@ -47,6 +47,7 @@ const F32 SHAPE_BUILDER_ENTRY_SNAP_SCALE_BIN_SIZE = 0.15f;
const F32 SHAPE_BUILDER_ENTRY_SNAP_PARAMETER_BIN_SIZE = 0.010f;
const F32 SHAPE_BUILDER_CONVEXIFICATION_SIZE = 2.f * COLLISION_TOLERANCE;
const F32 SHAPE_BUILDER_MIN_GEOMETRY_SIZE = 0.5f * COLLISION_TOLERANCE;
+const F32 SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE = 0.5f;
class LLPhysicsVolumeParams : public LLVolumeParams
{