How to create a model programmatically?

May 27, 2011 at 8:36 AM

Hi.

First of all, thanks for this cool project.

I need some help...This is what I have done:

-I created a new solution

-I added Babylon Engine project

-I added Babylon.Toolbox project

In MainPage.xaml.cs I have a BabylonSurface and a camera:

GraphicsDevice = GraphicsDeviceManager.Current.GraphicsDevice;
DrawingSurface = new BabylonSurface();
DrawingSurface.Width = 1000;
DrawingSurface.Height = 600;

DrawingSurface.Engine.Device = GraphicsDevice;

MainCamera = new Camera("MainCamera", DrawingSurface.Scene);
MainCamera.Position = new Microsoft.Xna.Framework.Vector3(0, 10, -20);

All I have to do now is to add Models to the scene, but I can't figure out how to create one programmatically. I tried using Model.SetVertexBufferData<T>(..) with a set of vertices that defines a cube with solid faces. Still I can't see anything. I also mention that I set the camera target on my cube. I am doing something wrong?

 

 

Coordinator
May 27, 2011 at 1:06 PM

Hi dangerBOA,

the most simple for you is to download the sample included with the project.

You do not need to reference Babylon Engine if you do not want to use the full engine. the toolkit is a standalone solution for creating your own project.

 

David.