Xbox LIVE Indie Games

code sample details

Code Sample

Description:

This sample shows how to determine whether a player's cursor is over an object, and how to find out where on the screen an object is.


Sample Overview

There are several situations in which it can be useful to know the 3D equivalent of a point on the screen, and vice versa: for example, checking to see whether a player has clicked on an object, or drawing text above a player's head. This can be accomplished by using the Project and Unproject methods on the Viewport class. This sample demonstrates the use of these methods.

In the sample, there's a table with several objects on it. If the user moves the cursor over an object, the object's name is drawn.



All content and source code downloaded from this page are bound to the Microsoft Permissive License (Ms-PL).

 

downloads

Framework

GS 4.0

find education content
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG