SetObjectScale: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{client function}}
{{Server client function}}
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.
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.


{{New feature|3.0110|1.1|
{{New feature|3.0110|1.1|
Server and clientside in 1.1
Available server-side. Only available client-side for 1.0.4 and lower.
}}
}}


Line 21: Line 21:
==Example==
==Example==
This example creates an antenna, and changes the size of it.
This example creates an antenna, and changes the size of it.
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- get the position of the player
-- get the position of the player
Line 33: Line 34:
end
end
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client_object_functions}}
{{Client_object_functions}}

Revision as of 10:47, 8 November 2010

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.

Available server-side. Only available client-side for 1.0.4 and lower.

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.

Click to collapse [-]
Client
-- 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