Exemple #1
0
        public static SingleGameObject CreateStaticAABB(IEntityManager manager, BoundingBox box)
        {
            var tag = new ElementTag("Physics Static " + Guid.NewGuid());

            var geobox = GeometryBuilder.BuildGeoBox(box);

            manager.CreateEntity(tag)
            .AddComponents(new IGraphicComponent[] {
                new SimpleGeometryComponent {
                    Positions = geobox.Positions.ToImmutableArray(),
                    Indices   = geobox.Indices.ToImmutableArray(),
                    Normals   = geobox.Positions.CalculateNormals(geobox.Indices).ToImmutableArray(),
                    Color     = new Vector4(1, 0, 0, 1)
                },
                new D3DTriangleColoredVertexRenderComponent(),
                TransformComponent.Identity(),
                PhysicalComponentFactory.CreateStaticAABB(),
            });

            return(new PhysicsObjectTest(tag));
        }