SetObjectScale: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{client function}} This function changes the visible size of an object. ==Syntax== <syntaxhighlight lang="lua"> bool setObjectScale ( element theElement, float scale ) </syntaxhighlight> ===Required A...)
 
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{client function}}
{{client function}}
This function changes the visible size of an object.
This function changes the visible size of an object. It is '''very important''' to note that this '''does not''' affect the collision models for the object, as such this is unsuitable for use for interaction with players, vehicles or other objects.


==Syntax==
==Syntax==
Line 10: Line 10:
===Required Arguments===
===Required Arguments===
*'''theElement''': The element you wish to change the size of.
*'''theElement''': The element you wish to change the size of.
*'''scale''': a float containing the new scale.
*'''scale''': a float containing the new scale. 1.0 is the standard scale, with 0.5 being half the size and 2.0 being twice the size.
 


===Returns===
===Returns===
Returns true if the scale was set properly, false otherwise.
Returns true if the scale was set properly, false otherwise.


==Example==
==Example==

Revision as of 18:33, 6 November 2007

This function changes the visible size of an object. It is very important to note that this does not affect the collision models for the object, as such this is unsuitable for use for interaction with players, vehicles or other objects.

Syntax

bool setObjectScale ( element theElement, float scale )

Required Arguments

  • theElement: The element you wish to change the size of.
  • scale: a float containing the new scale. 1.0 is the standard scale, with 0.5 being half the size and 2.0 being twice the size.

Returns

Returns true if the scale was set properly, false otherwise.

Example

This example creates an antenna, and changes the size of it.

-- get the position of the player
local x, y, z = getElementPosition(getLocalPlayer())
-- create the object
antenna = createObject (1595, x + 2, y, z )
if ( antenna ) then -- if it was created
	-- set the scale
	setObjectScale ( antenna, 0.5)
	-- remove the collision
        setElementCollisionsEnabled (antenna, false)
end

See Also