FBX model

Hi
I want to display a cube 3D. I use a FBX model but the cube not appear I don’t know why :confused:
`

public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    private Model _cube;

    /// <summary>
    /// Une matrice = tableau de 4 ligne et 4 colonne
    /// Notion mathematique ça cartographie une 3D 1 => X 2 => Y 3 => Z 4=> Translation
    /// Tous les axe son en 3D
    /// </summary>
    private Matrix _world;
    private Matrix _view;
    private Matrix _projection;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    /// <summary>
    /// Allows the game to perform any initialization it needs to before starting to run.
    /// This is where it can query for any required services and load any non-graphic
    /// related content.  Calling base.Initialize will enumerate through any components
    /// and initialize them as well.
    /// </summary>
    protected override void Initialize()
    {
        // TODO: Add your initialization logic here
        _world = Matrix.Identity;

        _view = Matrix.CreateLookAt(
                new Vector3(0, 0, 0),
                new Vector3(0,0,0),
                Vector3.UnitY
            );

        _projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45f),
                16f/9f,
                1f,
                100f
            );

        base.Initialize();
    }

    /// <summary>
    /// LoadContent will be called once per game and is the place to load
    /// all of your content.
    /// </summary>
    protected override void LoadContent()
    {
        _cube = Content.Load<Model>("cube");
        // Create a new SpriteBatch, which can be used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);

        // TODO: use this.Content to load your game content here
    }

    /// <summary>
    /// UnloadContent will be called once per game and is the place to unload
    /// game-specific content.
    /// </summary>
    protected override void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }

    /// <summary>
    /// Allows the game to run logic such as updating the world,
    /// checking for collisions, gathering input, and playing audio.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            Exit();

        // TODO: Add your update logic here

        base.Update(gameTime);
    }

    private void DrawModel(Model model, Matrix world, Matrix view, Matrix projection)
    {

        foreach(ModelMesh mesh in model.Meshes)
        {
            foreach(BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = world;
                effect.View = view;
                effect.Projection = projection;
            }
            mesh.Draw();
        }

    }

    /// <summary>
    /// This is called when the game should draw itself.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        DrawModel(_cube, _world, _view, _projection);

        base.Draw(gameTime);
    }
}

}

`
Its my code
I’ve read the fbx extension is not support by Monogame but which extension is support ?
Thanks for help

You are creating a LookAt Matrix fom 0,0,0 to 0,0,0 … I don’t think it’ll work that way, because it’s not even a distinct direction.

2 Likes