SetObjectMass: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Needs_Example}} __NOTOC__ {{client_functions}} {{New feature/item|3.0140|1.4|5170| This function sets the mass of a specified object. Changing the mass leads to a different mov...") |
mNo edit summary |
||
(8 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{client_function}} | ||
{{New feature/item|3. | {{New feature/item|3.0132|1.3.2|5170| | ||
This function sets the mass of a specified object. Changing the mass leads to a different movement behavior for especially dynamic objects. | This function sets the mass of a specified object. Changing the mass leads to a different movement behavior for especially dynamic objects. | ||
}} | }} | ||
Line 8: | Line 7: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setObjectMass ( float mass ) | bool setObjectMass ( object theObject, float mass ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[object]]:setMass|mass|getObjectMass}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''mass:''' | *'''theObject:''' the object whose mass will be set. | ||
*'''mass:''' the new mass. | |||
===Returns=== | ===Returns=== | ||
* ''true'' if the new mass value has been. | |||
* ''false'' otherwise. | |||
==Example== | ==Example== | ||
This script basically creates an object then get's the mass and set's its mass 300 more than it's original mass, then tell the client the old and new mass of the object. | |||
<syntaxhighlight lang="lua">local object = createObject(1225,0,0,3) | |||
local oldMass = getObjectMass(object) | |||
local newMass = oldMass+300.0 | |||
setObjectMass(object,newMass) | |||
outputChatBox("Object Old Mass: "..oldMass..", New Mass: "..newMass)</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Client_object_functions}} | {{Client_object_functions}} |
Latest revision as of 23:08, 4 October 2014
This function sets the mass of a specified object. Changing the mass leads to a different movement behavior for especially dynamic objects.
Syntax
bool setObjectMass ( object theObject, float mass )
OOP Syntax Help! I don't understand this!
- Method: object:setMass(...)
- Variable: .mass
- Counterpart: getObjectMass
Required Arguments
- theObject: the object whose mass will be set.
- mass: the new mass.
Returns
- true if the new mass value has been.
- false otherwise.
Example
This script basically creates an object then get's the mass and set's its mass 300 more than it's original mass, then tell the client the old and new mass of the object.
local object = createObject(1225,0,0,3) local oldMass = getObjectMass(object) local newMass = oldMass+300.0 setObjectMass(object,newMass) outputChatBox("Object Old Mass: "..oldMass..", New Mass: "..newMass)
See Also
- createObject
- getObjectScale
- moveObject
- setObjectScale
- stopObject
- getObjectMass
- getObjectProperty
- setObjectMass
- setObjectProperty