Squirrel/Client/Functions/Misc/WorldPosToScreen

From Liberty Unleashed Wiki
Jump to: navigation, search

Contents

Syntax

  1. VectorScreen WorldPosToScreen( Vector Position )

Arguments

  • Vector - A 3D vector value from a world position.

Example

This code will get a position on the screen (for GUI) from a 3D position in the game.

  1.  
  2. function onClientCommand(cmd, text)
  3. {
  4. if(cmd == "myscreenpos")
  5. {
  6. local LocalPlayer = FindLocalPlayer( );
  7. local myScreenPos = WorldPosToScreen ( LocalPlayer.Pos );
  8. Message ( "The screen position is " + myScreenPos.x + ", " + myScreenPos.y );
  9. }
  10. }
  11.  

Notes

The event onClientCommand and function FindLocalPlayer was used in this example. More information is available on its corresponding page.

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox