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

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

Computes the center of the shape. This can be considered its center of mass, based on the weightings of entries in the shape. For properly calibrated compound shapes, this will return a zero vector, since the shape recenters itself on construction.
public ComputeCenter ( ) : System.Vector3
Результат System.Vector3
        public override Vector3 ComputeCenter()
        {
            float totalWeight = 0;
            var center = new Vector3();
            for (int i = 0; i < shapes.Count; i++)
            {
                totalWeight += shapes.Elements[i].Weight;
                Vector3 centerContribution;
                Vector3.Multiply(ref shapes.Elements[i].LocalTransform.Position, shapes.Elements[i].Weight, out centerContribution);
                Vector3.Add(ref center, ref centerContribution, out center);

            }
            Vector3.Multiply(ref center, 1 / totalWeight, out center);
            return center;
        }

Same methods

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