diff options
author | Dave Parks <davep@lindenlab.com> | 2010-10-05 16:55:19 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-10-05 16:55:19 -0500 |
commit | 1f00747cd2accbe1b243e5c23f6e74a061a22bfa (patch) | |
tree | a3c103fe5b4e51d7452cca2989da0b99b815df8f /indra/llprimitive | |
parent | 87a9f475756d54d9d98c8cbb6395f89d6fc4606a (diff) |
Post review cleanup.
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/llmodel.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index d1e89a1ba5..1cada567e9 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1728,3 +1728,25 @@ 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; +} + + |