ScreenToTerrain

This method matches a pixel on the screen to the terrain coordinates that represent that pixel.

It is advised to use IRender4::ScreenToWorld() instead of the this method.

 

HRESULT ScreenToTerrain(

[in] int X,

[in] int Y,

[out] VARIANT* doubleTerrainX,

[out] VARIANT* doubleTerrainY,

[out] VARIANT* doubleTerrainElevation)

Parameters:

Note: The height coordinate is returned here in MPT coordinates and not relative to the ground since, in that case, it would always be zero.

Return Values:

The return value obtained from the returned HRESULT can be one of the following:

 

Return value

Meaning

S_OK

Success.

E_FAIL

Catastrophic failure.

 

Remarks:

If a pixel that is chosen does not fall in the 3D Window, the terrain coordinates that are returned have are all zero.