BEPUphysics.CollisionShapes.CompoundShape.ComputeCenter C# (CSharp) Метод

ComputeCenter() публичный статический Метод

Computes the center of a compound using its child data. Children are weighted using their volumes for contribution to the center of 'mass.'
public static ComputeCenter ( IList childData ) : System.Vector3
childData IList Child data to use to compute the center.
Результат System.Vector3
        public static Vector3 ComputeCenter(IList<CompoundShapeEntry> childData)
        {
            var center = new Vector3();
            float totalWeight = 0;
            for (int i = 0; i < childData.Count; i++)
            {
                float weight = childData[i].Weight;
                totalWeight += weight;
                center += childData[i].LocalTransform.Position * weight;
            }
            Vector3.Divide(ref center, totalWeight, out center);
            return center;

        }

Same methods

CompoundShape::ComputeCenter ( ) : System.Vector3
CompoundShape::ComputeCenter ( IList childData ) : System.Vector3
CompoundShape::ComputeCenter ( float &volume ) : System.Vector3