SetObjectMass: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(OOP)
Line 9: Line 9:
bool setObjectMass ( object theObject, float mass )
bool setObjectMass ( object theObject, float mass )
</syntaxhighlight>
</syntaxhighlight>
 
{{OOP||[[object]]:setMass|mass|getObjectMass]]
===Required Arguments===
===Required Arguments===
*'''theObject:''' The object whose mass will be set.
*'''theObject:''' the object whose mass will be set.
*'''mass:''' The new mass.
*'''mass:''' the new mass.


===Returns===
===Returns===
Returns ''true'' if the new mass value has been set, ''false'' otherwise.
* ''true'' if the new mass value has been.
* ''false'' otherwise.


==Example==
==Example==

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||object:setMass|mass|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

Shared