Tutorial 2.3: Adding A Camera To The Scene
Now that we have an actor and a model, all thats left is the camera. To add a camera, add the following code after declaring our model and actor in the Initialize function.
XCameras.AddCamera("Main");

Running the code, you will see that the camera is actually inside the model. To fix this, we will reposition our camera:
XCameras.Camera("Main").Position = new Vector3(0, 50, -150);

You should now be able to see the ship model when running the code.

Tutorial2.JPG

That's it, those 5 lines of code are all it takes to create and position a model, actor, and camera in the X-Engine. You can download the source code for this tutorial here: Tutorial2.zip

Last edited Mar 23, 2008 at 6:41 AM by Hazardous101, version 4

Comments

No comments yet.