SetObjectScale: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setObjectScale ( | bool setObjectScale ( object theObject, float scale ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''theObject''': The object you wish to change the scale 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. | *'''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. | ||
Line 23: | Line 23: | ||
antenna = createObject (1595, x + 2, y, z ) | antenna = createObject (1595, x + 2, y, z ) | ||
if ( antenna ) then -- if it was created | if ( antenna ) then -- if it was created | ||
-- set the scale | -- set the scale to half the normal scale | ||
setObjectScale ( antenna, 0.5) | setObjectScale ( antenna, 0.5) | ||
-- remove the collision | -- remove the collision |
Revision as of 19:24, 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 ( object theObject, float scale )
Required Arguments
- theObject: The object you wish to change the scale 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 to half the normal scale setObjectScale ( antenna, 0.5) -- remove the collision setElementCollisionsEnabled (antenna, false) end
See Also