dxDrawModel3D
Client-side
Server-side
Shared
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
- 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.
- This function doesn't obey any streaming limits, you can draw as many models as you want.
- You can not use this function to draw vehicles and ped.
- 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.
- 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): Lighting of model. Allowed range is 0-1.
Returns
- bool: result
Returns true if the operation was successful, false otherwise.
Code Examples
client
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)endChangelog
Added lighting argument.
See Also
Drawing Functions
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTargetUpdated
- dxCreateScreenSource
- dxCreateShader
- dxCreateTextureUpdated
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawModel3DNew
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsFormat
- dxGetPixelsSize
- dxGetStatusUpdated
- dxGetTextSize
- dxGetTexturePixelsUpdated
- dxGetTextWidth
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetShaderValue
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource

