Back in the late 1980s, there was a TV show called “Star Trek: The Next Generation”. That was the one where “Jean-Luc Picard” was the captain of the Enterprise. One of the key plot devices they had going for the show was a room onboard the ship called the “holodeck”. The room created a computer generated virtual reality that everyone in the room could experience.
http://en.wikipedia.org/wiki/Holodeck
Programming XNA in 3D reminds me of that. A lot of times you want to create virtual worlds for people to experience. It’s very similar even if the technology is different. So in this spirit, I want to create our own “holodeck” to start building 3D worlds on.
In this tutorial, we’ll start by building a square room, much like the holodeck from Star Trek. The original holodeck was basically just a big square room when it wasn’t turned on. Likewise, we’ll build a cube using a .x model file and paint it by making our own texture. Then we’ll add some code to move our camera, so that we can tell that it actually is 3D and not just a 2D picture that we’re looking at. Then we’ll add a model, so that we’re not alone on the holodeck. Next we’ll build a camera system that allows us to move around and see things better. And finally, we’ll address the problem that all the objects in our scene are “ethereal”, like ghosts, including the walls of the room. So, to wrap things up we’ll make everything solid so that we no longer pass through everything like a ghost.
Complete Project for Visual C# 2010 Express edition as a Compressed Zip file
Some of the concepts that you’ll learn from this tutorial are:
We are going to begin our exploration of 3D virtual realities by paying tribute to the 1980's television show Star Trek: the Next Generation and their virutal reality room known as the holodeck.
The picture shown is a screen shot from the end result of this tutorial. Nothing too fancy but keep in mind that we've used a chair model here but you're going to learn how to bring in any model you like including creating your own models and putting them on the holodeck.
Essentially, we'll create the holodeck room and by the end of the tutorial we will make the walls of the room solid, we will make it look like we are walking around the room and able to move anywhere around the room and look in different directions. We'll place an object in the room to learn how to put objects into our virtual reality. But we'll quickly see that everything in this virtual reality is "etherial", like a ghost, and we can't make physical contact with anything.
We will implement some simple "collision detection" in order to make the object solid as well as the walls of the room.
And we will add audio to make our movement in the room seem more realistic.
By the end of this tutorial, you should understand how to place your own objects into the room and use collision detection to interact with the objects. You also will start developing an understanding of "cameras" and how to move around in this virtual reality you have created.