示例#1
0
 public IslandPart(IPositionComponent physical, IMeshRenderComponent renderComponent, BasicPhysicsPart physics, IslandMeshFactory islandMeshFactory)
 {
     Physical          = physical;
     RenderComponent   = renderComponent;
     Physics           = physics;
     IslandMeshFactory = islandMeshFactory;
 }
示例#2
0
        public void FixPhysical()
        {
            if (RenderComponent.Mesh != null)
            {
                return;
            }
            RenderComponent.Mesh = IslandMeshFactory.GetMesh(Seed);
            var boundingBox = TW.Assets.GetBoundingBox(RenderComponent.Mesh);
            var center      = (boundingBox.Minimum + boundingBox.Maximum) * 0.5f;

            center.Y = boundingBox.Maximum.Y;
            RenderComponent.ObjectMatrix = Matrix.Translation(-center);
        }