SetObjectProperty: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0157|1.5.6|14370|This function sets a property of the specified object.}} ==Syntax== <syntaxhighlight lang="lua">bool...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 7: | Line 7: | ||
{{OOP||[[object]]:setProperty||getProperty}} | {{OOP||[[object]]:setProperty||getProperty}} | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theObject''' | *'''theObject:''' the [[object]] you wish to change a property of. | ||
*'''property:''' | *'''property:''' the property you want to set the value of: | ||
{{Object Properties}} | {{Object Properties}} | ||
*'''value:''' | *'''value:''' the new value for the property. | ||
===Returns=== | ===Returns=== | ||
Line 21: | Line 21: | ||
local theObject = createObject(980, 0, 0, 0) -- create an object | local theObject = createObject(980, 0, 0, 0) -- create an object | ||
if theObject then | if theObject then | ||
setObjectProperty(theObject, "center_of_mass", 0, -1, 0) -- set | setObjectProperty(theObject, "center_of_mass", 0, -1, 0) -- set its center of mass | ||
end | end | ||
end) | end) |
Latest revision as of 07:50, 28 October 2021
This function sets a property of the specified object.
Syntax
bool setObjectProperty ( object theObject, string property, var value )
OOP Syntax Help! I don't understand this!
- Method: object:setProperty(...)
- Counterpart: getProperty
Required Arguments
- theObject: the object you wish to change a property of.
- property: the property you want to set the value of:
- "mass" - float
- "turn_mass" - float
- "air_resistance" - float
- "elasticity" - float
- "center_of_mass" - Vector3D - (x, y, z)
- "buoyancy" - float
- value: the new value for the property.
Returns
Returns true if the property was set successfully, false otherwise.
Example
Click to collapse [-]
ClientaddEventHandler("onClientResourceStart", resourceRoot, function() local theObject = createObject(980, 0, 0, 0) -- create an object if theObject then setObjectProperty(theObject, "center_of_mass", 0, -1, 0) -- set its center of mass end end)
See Also
- createObject
- getObjectScale
- moveObject
- setObjectScale
- stopObject
- getObjectMass
- getObjectProperty
- setObjectMass
- setObjectProperty