Graphics::drawMarker: Difference between revisions

From RAGE Multiplayer Wiki
mNo edit summary
No edit summary
Line 1: Line 1:
Marker Types[https://wiki.rage.mp/index.php?title=Markers]<br><br>
__NOTOC__
dirX/Y/Z represent a heading on each axis in which the marker should face, alternatively you can rotate each axis independently with rotX/Y/Z (and set dirX/Y/Z all to 0).
===Description===
<br><br>
Use this function to draw a marker.
*'''faceCamera''' - Rotates only the y-axis (the heading) towards the camera
 
*'''p19''' - no effect, default value in script is 2
This function is used in a ''render'' event.
*'''rotate''' - Rotates only on the y-axis (the heading)
===Syntax===
*'''textureDict''' - Name of texture dictionary to load texture from (e.g. 'GolfPutting')
{{ClientSide}}
*'''textureName''' - Name of texture inside dictionary to load (e.g. 'PuttingMarker')
<syntaxhighlight lang="javascript">
*'''drawOnEnts''' - Draws the marker onto any entities that intersect it
mp.game.graphics.drawMarker(type,
<br><br>basically what he said, except textureDict and textureName are totally not char*, or if so, then they are always set to 0/NULL/nullptr in every script I checked, eg:<br><br>bj.c: graphics::draw_marker(6, vParam0, 0f, 0f, 1f, 0f, 0f, 0f, 4f, 4f, 4f, 240, 200, 80, iVar1, 0, 0, 2, 0, 0, 0, false);<br><br>his is what I used to draw an amber downward pointing chevron 'V', has to be redrawn every frame.  The 180 is for 180 degrees rotation around the Y axis, the 50 is alpha, assuming max is 100, but it will accept 255.<br><br>GRAPHICS::DRAW_MARKER(2, v.x, v.y, v.z + 2, 0, 0, 0, 0, 180, 0, 2, 2, 2, 255, 128, 0, 50, 0, 1, 1, 0, 0, 0, 0);<br><br>
  posX, posY, posZ,
==Syntax==
  dirX, dirY, dirZ,
<syntaxhighlight lang="javascript">mp.game.graphics.drawMarker(type, posX, posY, posZ, dirX, dirY, dirZ, rotX, rotY, rotZ, scaleX, scaleY, scaleZ, colorR, colorG, colorB, alpha, bobUpAndDown, faceCamera, p19, rotate, textureDict, textureName, drawOnEnts);</syntaxhighlight>
  rotX, rotY, rotZ,
  scaleX, scaleY, scaleZ,
  colorR, colorG, colorB, alpha,
  bobUpAndDown, faceCamera, p19,
  rotate, textureDict, textureName, drawOnEnts
);
</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''type:''' int
*'''type''': {{RageType|number}}
*'''posX:''' float
*'''posX''': {{RageType|number}}
*'''posY:''' float
*'''posY''': {{RageType|number}}
*'''posZ:''' float
*'''posZ:''': {{RageType|number}}
*'''dirX:''' float
*'''dirX''': {{RageType|number}}
*'''dirY:''' float
*'''dirY''': {{RageType|number}}
*'''dirZ:''' float
*'''dirZ''': {{RageType|number}}
*'''rotX:''' float
*'''rotX''': {{RageType|number}}
*'''rotY:''' float
*'''rotY''': {{RageType|number}}
*'''rotZ:''' float
*'''rotZ''': {{RageType|number}}
*'''scaleX:''' float
*'''scaleX''': {{RageType|number}}
*'''scaleY:''' float
*'''scaleY''': {{RageType|number}}
*'''scaleZ:''' float
*'''scaleZ''': {{RageType|number}}
*'''colorR:''' int
*'''colorR''': {{RageType|number}}
*'''colorG:''' int
*'''colorG''': {{RageType|number}}
*'''colorB:''' int
*'''colorB''': {{RageType|number}}
*'''alpha:''' int
*'''alpha''': {{RageType|number}}
*'''bobUpAndDown:''' Boolean
*'''bobUpAndDown''': {{RageType|boolean}}
*'''faceCamera:''' Boolean
*'''faceCamera''': {{RageType|boolean}}
*'''p19:''' int
*'''p19''': {{RageType|number}}
*'''rotate:''' Boolean
*'''rotate''': {{RageType|boolean}}
*'''textureDict:''' String
*'''textureDict''': {{RageType|string}}
*'''textureName:''' String
*'''textureName''': {{RageType|string}}
*'''drawOnEnts:''' Boolean
*'''drawOnEnts''': {{RageType|boolean}}
===Return value===
===Return value===
*'''Undefined'''
*{{RageType|void}}
==Example==
==Example==
This example will create a little marker above the player's head.
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
new mp.Event('render', () => {
  let pos = mp.players.local.position;
 
  mp.game.graphics.drawMarker(
    0,
    pos.x, pos.y, pos.z + 2,
    0, 0, 0,
    0, 0, 0,
    1.0, 1.0, 1.0,
    255, 255, 255, 255,
    false, false, 2,
    false, "", "",false
  );
});
 
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Graphics_s_function_c}}
{{Graphics_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Revision as of 20:02, 19 January 2018

Description

Use this function to draw a marker.

This function is used in a render event.

Syntax

Client-Side
mp.game.graphics.drawMarker(type,
  posX, posY, posZ,
  dirX, dirY, dirZ,
  rotX, rotY, rotZ,
  scaleX, scaleY, scaleZ,
  colorR, colorG, colorB, alpha,
  bobUpAndDown, faceCamera, p19,
  rotate, textureDict, textureName, drawOnEnts
);

Required Arguments

  • type: number
  • posX: number
  • posY: number
  • posZ:: number
  • dirX: number
  • dirY: number
  • dirZ: number
  • rotX: number
  • rotY: number
  • rotZ: number
  • scaleX: number
  • scaleY: number
  • scaleZ: number
  • colorR: number
  • colorG: number
  • colorB: number
  • alpha: number
  • bobUpAndDown: boolean
  • faceCamera: boolean
  • p19: number
  • rotate: boolean
  • textureDict: string
  • textureName: string
  • drawOnEnts: boolean

Return value

  • void

Example

This example will create a little marker above the player's head.

new mp.Event('render', () => {
  let pos = mp.players.local.position;

  mp.game.graphics.drawMarker(
    0,
    pos.x, pos.y, pos.z + 2,
    0, 0, 0,
    0, 0, 0,
    1.0, 1.0, 1.0,
    255, 255, 255, 255,
    false, false, 2,
    false, "", "",false
  );
});

See also