dxDrawModel3D | Multi Theft Auto: Wiki Skip to content

dxDrawModel3D

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


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.

Important

You can not use this function to draw vehicles and ped

Important

This function doesn't obey any streaming limits, you can draw as many models as you want

Important

You can not render model to render target.

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 ] )
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

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • scaleX (default: 1): a float containing the new scale on the X axis
  • scaleY (default: 1): a float containing the new scale on the Y axis
  • scaleZ (default: 1): a float containing the new scale on the Z axis
  • lighting (default: 0): MISSING_PARAM_DESC

Returns

  • bool: value

Returns true if the operation was successful, false otherwise.

Code Examples

shared

This example draws a model

local modelId = 1337
local function drawMyModel()
dxDrawModel3D(modelId, 0, 0, 4, 0, 0, 0)
end
local function startDraw()
engineStreamingRequestModel(modelId, true, true)
addEventHandler("onClientPreRender", root, drawMyModel)
end
local function stopDraw()
engineStreamingReleaseModel(modelId, true)
removeEventHandler("onClientPreRender", root, drawMyModel)
end