- Documentation
- Client functions
- dxDrawModel3D
Function
dxDrawModel3D
Draws a game object model at a spot for one frame: without collision, hidden by the world. It does not work for peds and vehicles. The first frame of a new model waits until the game loads it. At most 64 objects at once.
Syntax
bool dxDrawModel3D(int modelID, float x, y, z, float rx, ry, rz [, float scale = 1, float lighting])Arguments
modelIDint- Object model.
x, y, zfloat- Position.
rx, ry, rzfloat- Rotation.
scalefloat, optional = 1- Scale.
lightingfloat, optional- Accepted for compatibility with existing scripts.
Differences from MTA:SA
- These MTA:SA arguments are not here:
float scaleZ = 1,float lighting = 0
In MTA:SA
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)Returns
true if drawn or the model is loading.
Example
A preview of an object being placed in front of the player (e.g. in a map editor).
addEventHandler("onClientRender", root, function()
local x, y, z = getElementPosition(localPlayer)
dxDrawModel3D(1271, x, y + 3, z - 0.5, 0, 0, getTickCount() / 10 % 360)
end)
See also
createObjectCreates an object from a San Andreas model (e.g. 1337 bin, 3095 ramp, 1225 explosive barrel) or a model replaced withengineReplaceModel. Everyone in the same interior and dimension sees it; it stays in place and has collision. WithisBreakable = truethe game treats it as breakable and it can be smashed.dxDrawMaterialLine3DDraws a material (an image, a texture, a browser, a camera or a shader) as a strip in the 3D world: from the start point (top of the image) to the end, with a given width. The strip faces the camera or thefaceX, faceY, faceZpoint. The drawing is part of the world: buildings hide it and it glows (a screen is visible at night). This is how you make a billboard, a cinema screen or a sign above a building.