Universe.Physics.BulletSPlugin.BSLinkset.ComputeLinksetCenterOfMass C# (CSharp) Method

ComputeLinksetCenterOfMass() protected method

protected ComputeLinksetCenterOfMass ( ) : OpenMetaverse.Vector3
return OpenMetaverse.Vector3
        protected virtual OMV.Vector3 ComputeLinksetCenterOfMass()
        {
            OMV.Vector3 com;
            lock (m_linksetActivityLock)
            {
                com = LinksetRoot.Position * LinksetRoot.RawMass;
                float totalMass = LinksetRoot.RawMass;

                foreach (BSPrimLinkable bp in m_children.Keys)
                {
                    com += bp.Position * bp.RawMass;
                    totalMass += bp.RawMass;
                }
                if (totalMass != 0f)
                    com /= totalMass;
            }

            return com;
        }