Function _IrrGetScreenCoordinatesFrom3DPosition

au3Irr2

au3Irr2 Function Reference

_IrrGetScreenCoordinatesFrom3DPosition

Screen co-ordinates are returned for the position of the specified 3D co-ordinates.

#Include <au3Irrlicht2.au3>
_IrrGetScreenCoordinatesFrom3DPosition(ByRef $i_ScreenX, ByRef $i_ScreenY, $a_3DPositionVector)

 

Parameters

$i_ScreenX, $i_ScreenY Variables which will contain coordinates after call of the function.
$a_3DPositionVector 1D array with three elements for x, y, z values of a position in space.

 

Return Value

Success: True and sets passed $i_ScreenX and $i_ScreenY
Failure: False and @error = 1

 

Remarks

Screen co-ordinates are returned for the position of the specified 3D co-ordinates as if an object were drawn at them on the screen, this is ideal for drawing 2D bitmaps or text around or on your 3D object on the screen for example in the HUD of an aircraft.

 

Related

_IrrGet3DPositionFromScreenCoordinates, _IrrGet2DPositionFromScreenCoordinates

 

Example


#include "au3Irrlicht2.au3"

_IrrStart()

local $x, $y, $vect[3]
local $BitmapFont = _IrrGetFont ( "./media/bitmapfont.bmp" )

local $SceneNode = _IrrAddMeshToScene( _IrrGetMesh( "./media/zumlin.md2" ) )
_IrrSetNodeMaterialTexture( $SceneNode, _IrrGetTexture( "./media/zumlin.pcx" ), 0 )
_IrrSetNodeMaterialFlag( $SceneNode, $IRR_EMF_LIGHTING, $IRR_OFF )

local $nodeCam = _IrrAddFPSCamera( $IRR_NO_OBJECT, 100.0, 0.1 )
_IrrSetNodePosition( $nodeCam, 80,0,0 )
_IrrSetCameraTarget( $nodeCam, 0,0,0 )

$vect[1] = 35 ; move the vector to just over the nodes head

WHILE _IrrRunning()
    _IrrBeginScene(0, 0, 25)
    _IrrDrawScene()

    ; using 3D coordinate get x/y position of this coordinate; it appears on the screen
    _IrrGetScreenCoordinatesFrom3DPosition( $x, $y, $vect )
    ; draw the name of the model over the head of the model
    _Irr2DFontDraw ( $BitmapFont, "ZUMLIN", $x-15, $y-8, $x+35, $y )

    _IrrEndScene()
WEND

_IrrStop()