Universe.Physics.BulletSPlugin.BSAPIXNA.CreateHullShape C# (CSharp) Method

CreateHullShape() public method

public CreateHullShape ( BulletWorld pWorld, int pHullCount, float pConvHulls ) : BulletShape
pWorld BulletWorld
pHullCount int
pConvHulls float
return BulletShape
        public override BulletShape CreateHullShape(BulletWorld pWorld, int pHullCount, float[] pConvHulls)
        {
            DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
            CompoundShape compoundshape = new CompoundShape(false);

            compoundshape.SetMargin(world.WorldSettings.Params.collisionMargin);
            int ii = 1;

            for (int i = 0; i < pHullCount; i++)
            {
                int vertexCount = (int)pConvHulls[ii];

                IndexedVector3 centroid = new IndexedVector3(pConvHulls[ii + 1], pConvHulls[ii + 2], pConvHulls[ii + 3]);
                IndexedMatrix childTrans = IndexedMatrix.Identity;
                childTrans._origin = centroid;

                List<IndexedVector3> virts = new List<IndexedVector3>();
                int ender = ((ii + 4) + (vertexCount * 3));
                for (int iii = ii + 4; iii < ender; iii += 3)
                {
                    virts.Add(new IndexedVector3(pConvHulls[iii], pConvHulls[iii + 1], pConvHulls[iii + 2]));
                }
                ConvexHullShape convexShape = new ConvexHullShape(virts, vertexCount);
                convexShape.SetMargin(world.WorldSettings.Params.collisionMargin);
                compoundshape.AddChildShape(ref childTrans, convexShape);
                ii += (vertexCount * 3 + 4);
            }

            return new BulletShapeXNA(compoundshape, BSPhysicsShapeType.SHAPE_HULL);
        }
BSAPIXNA