summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodel.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-10-06 12:54:21 -0500
committerDave Parks <davep@lindenlab.com>2010-10-06 12:54:21 -0500
commitadc73f48471330617cc1e52902abd8123920ada3 (patch)
tree553b190684dccd0707de2570e614ebd91a30d8db /indra/llprimitive/llmodel.cpp
parent21b1b91c448b7d148a840c06d74deabc45af1819 (diff)
parent98d622551d9466d1153dedfbdd721becf8c38cd9 (diff)
Merge
Diffstat (limited to 'indra/llprimitive/llmodel.cpp')
-rw-r--r--indra/llprimitive/llmodel.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 9e3d9704ae..1cada567e9 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1724,4 +1724,29 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
}
}
+void LLModel::setPhysicsShape(const LLModel::physics_shape& shape)
+{
+ mPhysicsShape = shape;
+
+ mHullCenter.resize(mPhysicsShape.size());
+ mPhysicsPoints = 0;
+ mPhysicsCenter.clear();
+
+ for (U32 i = 0; i < shape.size(); ++i)
+ {
+ LLVector3 cur_center;
+
+ for (U32 j = 0; j < shape[i].size(); ++j)
+ {
+ cur_center += shape[i][j];
+ }
+ mPhysicsCenter += cur_center;
+ cur_center *= 1.f/shape[i].size();
+ mHullCenter[i] = cur_center;
+ mPhysicsPoints += shape[i].size();
+ }
+
+ mPhysicsCenter *= 1.f/mPhysicsPoints;
+}
+