XNA Creators Club Online

sample details

Picking
Sample
submitted
5/24/2007

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 where 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 is a table with several objects on it. If the user moves the cursor over an object, the object's name is drawn.

downloads
Framework

GS 2.0

Vertex Shader Version

VS 1.1

Pixel Shader Version

PS 1.1

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