BEPUphysics.BroadPhaseEntries.StaticMesh.UpdateBoundingBox C# (CSharp) Метод

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

Updates the bounding box to the current state of the entry.
public UpdateBoundingBox ( ) : void
Результат void
        public override void UpdateBoundingBox()
        {
            boundingBox = mesh.Tree.BoundingBox;
        }

Usage Example

        static void Build14(int gridSize, out VertexModifier vertexModifier, out Dictionary<string, MeshRebuilder> rebuilders)
        {
            List<Vector3B> vertices = new List<Vector3B>();

            for (int y = 0; y < gridSize; ++y)
                for (int x = 0; x < gridSize; ++x)
                    vertices.Add(new Vector3B(2 * x, 0, 2 * y));

            List<int> triangles = new List<int>();

            for (int y = 0; y < gridSize - 1; ++y)
                for (int x = 0; x < gridSize - 1; ++x)
                {
                    triangles.Add(gridSize * (y) + (x));
                    triangles.Add(gridSize * (y) + (x + 1));
                    triangles.Add(gridSize * (y + 1) + (x + 1));

                    triangles.Add(gridSize * (y) + (x));
                    triangles.Add(gridSize * (y + 1) + (x + 1));
                    triangles.Add(gridSize * (y + 1) + (x));
                }

            var physicsMesh = new BEPUphysics.BroadPhaseEntries.StaticMesh(vertices.ToArray(), triangles.ToArray(), BEPUutilities.AffineTransform.Identity);

            vertexModifier = (Random random) =>
            {
                for (int vertexIndex = 0; vertexIndex < physicsMesh.Mesh.Data.Vertices.Length; ++vertexIndex)
                    physicsMesh.Mesh.Data.Vertices[vertexIndex].Y = (float)random.NextDouble() * 2;
            };

            rebuilders = new Dictionary<string, MeshRebuilder>();
            rebuilders.Add("v1.4.0 Reconstruct", (i) =>
            {
                physicsMesh.Mesh.Tree.Reconstruct();
                physicsMesh.UpdateBoundingBox();
            });
            rebuilders.Add("v1.4.0 Refit", (i) =>
            {
                physicsMesh.Mesh.Tree.Refit();
                physicsMesh.UpdateBoundingBox();
            });
        }