DxDrawModel3D: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Update Arguments)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:


==Syntax==
==Syntax==
<syntaxhighlight lang="lua"> =
<syntaxhighlight lang="lua">
bool dxDrawModel3D( int modelId, float positionX, float positionY, float positionZ, float rotationX, float rotationY, float rotationZ [, float scaleX = 1, float scaleY = 1, float scaleZ = 1, float lighting = 0 ])
bool dxDrawModel3D( int modelId, float positionX, float positionY, float positionZ, float rotationX, float rotationY, float rotationZ [, float scaleX = 1, float scaleY = 1, float scaleZ = 1, float lighting = 0 ])
</syntaxhighlight>
</syntaxhighlight>
Line 17: Line 17:


===Required Arguments===  
===Required Arguments===  
* '''modelId:''' Model you want to draw, must be regular object, you can not draw vehicles and peds
* '''modelId:''' [[object]] you want to draw, must be regular object, you can not draw vehicles and peds. See [[Object_IDs|Object IDs]] for a list of model IDs.
* '''positionX/Y/Z:''' Position of model
*'''positionX:''' A floating point number representing the X coordinate on the map.
* '''rotationX/Y/Z:''' Rotation of model
*'''positionY:''' A floating point number representing the Y coordinate on the map.
*'''positionZ:''' A floating point number representing the Z coordinate on the map.
*'''rotationX:''' A floating point number representing the rotation about the X axis in degrees.
*'''rotationY:''' A floating point number representing the rotation about the Y axis in degrees.
*'''rotationZ :''' A floating point number representing the rotation about the Z axis in degrees.


===Optional Arguments===
===Optional Arguments===
* '''scaleX/Y/Z:''' Scale of model, by default {1,1,1}
*'''scaleX''': a float containing the new scale on the X axis
*'''scaleY''': a float containing the new scale on the Y axis
*'''scaleZ''': a float containing the new scale on the Z axis
 
{{New feature/item|3.0161|1.6.0|22862|
{{New feature/item|3.0161|1.6.0|22862|
*'''lighting:''' Lighting of model. Allowed range is [0, 1].
*'''lighting:''' Lighting of model. Allowed range is [0, 1].
Line 30: Line 37:
===Returns===
===Returns===
Returns true if the operation was successful, false otherwise.
Returns true if the operation was successful, false otherwise.


==Example==  
==Example==  

Latest revision as of 20:00, 3 January 2025

[[{{{image}}}|link=|]] Important Note: You can not use this function to draw vehicles and ped
[[{{{image}}}|link=|]] Important Note: This function doesn't obey any streaming limits, you can draw as many models as you want
[[{{{image}}}|link=|]] Important Note: You can not render model to render target.
ADDED/UPDATED IN VERSION 1.6.0 r22708:

This function draws a 3D model - rendered for one frame. Drawn models are indistinguishable from this one created by createObject function. This should be used in conjunction with onClientRender or onClientPreRender in order to display continuously. Note that a model must be loaded at the time this function is called. A model can be loaded and unloaded with the help of engineStreamingRequestModel and engineStreamingReleaseModel functions.

Syntax

bool dxDrawModel3D( int modelId, float positionX, float positionY, float positionZ, float rotationX, float rotationY, float rotationZ [, float scaleX = 1, float scaleY = 1, float scaleZ = 1, float lighting = 0 ])
Model during day
Model during night

Required Arguments

  • modelId: object you want to draw, must be regular object, you can not draw vehicles and peds. See Object IDs for a list of model IDs.
  • positionX: A floating point number representing the X coordinate on the map.
  • positionY: A floating point number representing the Y coordinate on the map.
  • positionZ: A floating point number representing the Z coordinate on the map.
  • rotationX: A floating point number representing the rotation about the X axis in degrees.
  • rotationY: A floating point number representing the rotation about the Y axis in degrees.
  • rotationZ : A floating point number representing the rotation about the Z axis in degrees.

Optional Arguments

  • scaleX: a float containing the new scale on the X axis
  • scaleY: a float containing the new scale on the Y axis
  • scaleZ: a float containing the new scale on the Z axis
ADDED/UPDATED IN VERSION 1.6.0 r22862:
  • lighting: Lighting of model. Allowed range is [0, 1].


Returns

Returns true if the operation was successful, false otherwise.

Example

Click to collapse [-]
Client

Simple example

addEventHandler("onClientPreRender", root, function()
    engineStreamingRequestModel(3276)
    dxDrawModel3D(3276, -719.64984, 951.26685, 12.13281, 0, 0,90)
end)

See Also