SetLowLODElement: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 62: Line 62:
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
 
==Requirements==
{{Requirements|1.2|1.2}}
==See Also==
==See Also==
{{Element_functions}}
{{Element_functions}}

Revision as of 22:19, 6 December 2011

Available only in MTA SA 1.2 This function assigns a low LOD element to an element. The low LOD element is displayed when its associated element is not fully visible. If a low LOD element is assigned to several elements, it will be displayed when any of these elements are not fully visible.

Syntax

bool setLowLODElement ( element theElement, element lowLODElement )

Required Arguments

  • theElement: The element whose low LOD version we want to change.
  • lowLODElement : A low LOD element to display when the first element is not fully visible.

Returns

Returns true if the assignment was successful, false otherwise.

Example

Click to collapse [-]
Clientside example

This example shows how to create and link a normal and low LOD object:

    -- Create an normal object
    objNormal = createObject ( 3620, x,y,z,0,0,0 )

    -- Create a low LOD object
    objLowLOD = createObject ( 5154, x,y,z,0,0,0,true )

    -- Set the normal object low LOD version
    setLowLODElement ( objNormal, objLowLOD )
Click to collapse [-]
Serverside example

This example shows how to create and link a composite object

    -- Create composite object
    objMainBit = createObject ( 3620, x,y,z )
    objLeftBit = createObject ( 5158, x,y,z )
    objRightBit = createObject ( 5158, x,y,z )
    objDetailBit1 = createObject ( 1337, x,y,z )
    objDetailBit2 = createObject ( 1337, x,y,z )
    objInternalBit = createObject ( 1337, x,y,z )
    attachElements ( objLeftBit, objMainBit, -10, 0, 0 )
    attachElements ( objRightBit, objMainBit, 10, 0, 0 )
    attachElements ( objDetailBit1, objMainBit, 5, 0, 0 )
    attachElements ( objDetailBit2, objLeftBit, 5, 5, 0 )
    attachElements ( objInternalBit, objRightBit, 5, 7, 0 )

    -- Create low LOD object (which represents the whole composite model)
    objlowLOD = createObject ( 5154, x,y,z, 0, 0, 0, true )

    -- Attach low LOD object so it moves with the main model
    attachElements ( objlowLOD, objMainBit, 0, 0, 0 )

    -- Set associations so the low LOD model is displayed when the main parts are not full visible
    setLowLODElement ( objMainBit, objlowLOD )
    setLowLODElement ( objLeftBit, objlowLOD )
    setLowLODElement ( objRightBit, objlowLOD )

    -- Note that the detail and internal parts have not been associated to the low LOD object

Requirements

Minimum server version 1.2
Minimum client version 1.2

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.2" client="1.2" />

See Also

Shared