DxDrawMaterialLine3D: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m ("width" is definitely a float, not an integer.)
No edit summary
Line 10: Line 10:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dxDrawMaterialLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, element material, float width,
bool dxDrawMaterialLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, element material, float width,
                           [ int color = white, float faceTowardX, float faceTowardY, float faceTowardZ ] )
                           [ int color = white, [ bool postGUI = false, ] float faceTowardX, float faceTowardY, float faceTowardZ ] )
</syntaxhighlight>
</syntaxhighlight>


Line 22: Line 22:
{{OptionalArg}}
{{OptionalArg}}
* '''color:''' An [[int|integer]] of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).
* '''color:''' An [[int|integer]] of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).
{{New items|5.0155|1.5.5-9.11998|
* '''postGUI''': A bool representing whether the line should be drawn on top of or behind any ingame GUI.
}}
* '''faceTowardX/Y/Z:''' The position the front of the line should face towards. If this is not set, the camera position is used, so the front of the line faces toward the camera.
* '''faceTowardX/Y/Z:''' The position the front of the line should face towards. If this is not set, the camera position is used, so the front of the line faces toward the camera.


Line 40: Line 43:
==Requirements==
==Requirements==
{{Requirements|n/a|1.3.0-9.03931|}}
{{Requirements|n/a|1.3.0-9.03931|}}
==Changelog==
{{ChangelogHeader}}
{{ChangelogItem|1.5.5-9.11998|Added postGUI argument}}


==See Also==
==See Also==
{{Drawing_functions}}
{{Drawing_functions}}

Revision as of 18:07, 1 June 2018

This function draws a textured 3D line between two points in the 3D world - rendered for one frame. This should be used in conjunction with onClientPreRender in order to display continuously.

The 3D line with a large width value effectively becomes a rectangle, so it it possible to construct basic shapes such as boxes with several large width lines and the appropriate values for 'faceToward'.

3D lines are drawn at a particular place in the game processing order, so use onClientPreRender for drawing if you are attaching them to world elements.

Syntax

bool dxDrawMaterialLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, element material, float width,
                          [ int color = white, [ bool postGUI = false, ] float faceTowardX, float faceTowardY, float faceTowardZ ] )

Required Arguments

  • startX/Y/Z: The start position of the 3D line, representing a coordinate in the GTA world.
  • endX/Y/Z: The end position of the 3D line, representing a coordinate in the GTA world.
  • material: A material to draw the line with.
  • width: The width/thickness of the line in GTA world units. (This is 1/75th of the width used in dxDrawLine3D)

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • color: An integer of the hex color, produced using tocolor or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).
ADDED/UPDATED IN VERSION 1.5.5-9.11998 :
  • postGUI: A bool representing whether the line should be drawn on top of or behind any ingame GUI.
  • faceTowardX/Y/Z: The position the front of the line should face towards. If this is not set, the camera position is used, so the front of the line faces toward the camera.

Returns

Returns a true if the operation was successful, false otherwise.

Example

Click to collapse [-]
Client

Draws an Image ( "test.png" Download : test.png ) from the Position 0,0,3 to 0,0,15

local img = dxCreateTexture("test.png")
addEventHandler("onClientRender", root,
    function()  -- x,y,z, targetx,targety,targetz,texture,width,color
		dxDrawMaterialLine3D (0,0,3,0,0,15,img, 7, tocolor(255,255,255,255))
    end)

Requirements

Minimum server version n/a
Minimum client version 1.3.0-9.03931

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.3.0-9.03931" />

Changelog

Version Description
1.5.5-9.11998 Added postGUI argument

See Also