Difference between revisions of "Body:setMass"

m
(0.8.0 related stuff.)
Line 1: Line 1:
 +
{{newin|[[0.8.0]]|080|type=variant}}
 +
Sets a new body mass.
 +
 +
{{notice|There is a bug in [[0.8.0]] where a high mass will be too large for the rotational inertia and throw an uncaught exception resulting in the termination of LÖVE. It's recommended to use [[Body:setMassData]] instead.}}
 +
 +
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
Body:setMass( mass )
 +
</source>
 +
=== Arguments ===
 +
{{param|number|mass|The mass, in kilograms.}}
 +
=== Returns ===
 +
Nothing.
 +
 +
 +
 +
{{oldin|[[0.8.0]]|080|type=variant}}
 
Sets the mass properties directly.
 
Sets the mass properties directly.
  
Line 24: Line 42:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
----
 
{{newin|[[0.8.0]]|080|type=variants|plural=y}}
 
Function changed to setMassData( x, y, m, i). SetMass changed to setMass(m).
 
  
----
 
 
== See Also ==
 
== See Also ==
 
* [[parent::Body]]
 
* [[parent::Body]]

Revision as of 19:04, 16 May 2012

Available since LÖVE 0.8.0
This variant is not supported in earlier versions.

Sets a new body mass.

O.png There is a bug in 0.8.0 where a high mass will be too large for the rotational inertia and throw an uncaught exception resulting in the termination of LÖVE. It's recommended to use Body:setMassData instead.  


Function

Synopsis

Body:setMass( mass )

Arguments

number mass
The mass, in kilograms.

Returns

Nothing.


Removed in LÖVE 0.8.0
This variant is not supported in that and later versions.

Sets the mass properties directly.

If you're not sure what all this stuff means, you can use Body:setMassFromShapes after adding shapes instead.


The first two parameters will be the local coordinates of the Body's center of mass.


The third parameter is the mass, in kilograms.


The last parameter is the rotational inertia.

Function

Synopsis

Body:setMass( x, y, m, i )

Arguments

number x
The x-component of the center of mass in local coordinates.
number y
The y-component of the center of mass in local coordinates.
number m
The mass, in kilograms.
number i
The rotational inertia, in kilograms per squared meter.

Returns

Nothing.

See Also


Other Languages