To pick an object in a 3D game is relevant in terms of real-time strategy. For example, in StarCraft2, you can choose a construction from a 2D panel, then a semi-transparent 3D model will show up in the game view that lets you choose the best location for building the construction. Or, you can select your army by just clicking the left button of the mouse and drawing a rectangle covering the units you want to control. All of these happen between 2D and 3D. This is magic! Actually, this technique maps the clicking position in screen coordinate from 2D to 3D world. In this recipe, you will learn how this important mapping method works in the Windows Phone 7 game.
The following steps will lead you to make your own version of picking an object in a 3D game:
1. Create the Windows Phone Game project named
Pick3DModel
, changeGame1.cs
toPick3DModelGame.cs
and add a newMarker.cs
to the project. Then, we create a Content Pipeline Extension Library called...