Update: Chck out Version 1.1 of this flight simulator here:http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!773.entry
The Virtual Earth 3D control is a great tool when you not only want to know where some place is in the world, but also want to know what it looks like. This is particularly useful when traveling to new areas as landmarks can be easily identified ahead of time. Recently Microsoft released documentation on how to develop against this 3D API (http://blogs.msdn.com/virtualearth3d/archive/2009/01/25/documentation.aspx). Infusion development has been working with Virtual Earth 3D for well over a year now developing business applications. Most of these applications have been developed for the Microsoft Surface. Videos of various applications can be found here: http://www.youtube.com/InfusionDevelopment
One thing I’ve noticed is that there hasn’t been a lot of development against the 3D API yet outside of the business world. This article is going to show you how to create a simple flight simulator plug-in for Virtual Earth. Here is a screen shot of the finished product to get you motivated to read through this article. You can also download the source code for this here: http://cid-e7dba9a4bfd458c5.skydrive.live.com/self.aspx/VE%20Sample%20code/SimpleFlightSimulator.zip
Note you will need to re-add the references to the Virtual Earth DLL’s.
Here is a video to show it in action. Note I was just using the keyboard for the navigation in this screen capture.
Here is a video of it in action using an XBox 360 controller to navigate.
The first step is to install the Virtual Earth 3D control if you haven’t done so already. You can download it here: http://maps.live.com/Help/VE3DInstall/
The second step is to create an ASP >NET Web Application project. In Visual Studios 2008 you will have to do the following steps:
- Open Visual Studio 2005/2008.
- From the File menu, choose New | Project.
- Choose one of the Project Types. For example, Visual C#.
- From the Templates list, choose Class Library.
- Call the project SimpleFlightSimulator and verify the project Location.
- Click OK to create the solution.
The next step is to reference the Virtual Earth 3D DLL’s.
1. From the Solution Explorer, right click the project name and click Add Reference.
- In the popup window, click the Browse tab and navigate to the location where you installed the Virtual Earth 3D application. (eg. C:\Program Files\Virtual Earth 3D)
- Hold the CTRL key down and select:
4. A reference to System.Drawing, System.IO, System.Runtime.InteropServices, System.Threading and System.Reflection will also be needed.
- Click the OK button.
Now you will have to create the plug-in class. This can be done by doing the following:
1. Right click the new project’s name and select Add | New Item.
- Under Visual C# Items | Code, select the Class item and call your class SimpleFlightSimulatorPlugin.cs
- Click the Add button and open the newly created file. This file will represent our plug-in for this example.
- The first thing we need to do with this new plug-in is create a unique identifier. We do this using the GUID tool:
- In Visual Studio, click Tools | Create GUID.
- Select the Registry Format option.
- Click the New GUID button, and then the Copy button.
- Paste the GUID as an attribute of your class.
- Derive your class from the PlugIn class.
Part 2 – http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!752.entry
Part 3 – http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!751.entry
Part 4 – http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!750.entry