SetObjectMass: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 19: Line 19:


==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(1337,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}}

Revision as of 19:05, 6 May 2013

Accessories-text-editor.png Script Example Missing Function SetObjectMass needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.


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 )

Required Arguments

  • theObject: The object whose mass will be set.
  • mass: The new mass.

Returns

Returns true if the new mass value has been set, 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(1337,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