Documentation

WHAT WE GOT

AABB
Physics Environment

Animation
Actions & Animations

Array
Support Classes

Audio
Sounds & Music

Audio Effect
Sounds & Music

Background Audio
Sounds & Music

Bezier
Actions & Animations

Blink
Actions & Animations

Body
Physics Environment

Callback
Actions & Animations

Chain Shape
Physics Environment

Circle Shape
Physics Environment

Color
Support Classes

Delay
Actions & Animations

Device
Support Classes

Director
Essentials

Ease
Actions & Animations

Edge Shape
Physics Environment

Event
Support Classes

Fade
Actions & Animations

Filter
Physics Environment

Fixture
Physics Environment

Jump
Actions & Animations

Label
User Interface

Layer
Essentials

Layer Color
Essentials

Liquid
Actions & Animations

Mass Data
Physics Environment

Menu
User Interface

Menu Image
User Interface

Menu Label
User Interface

Move
Actions & Animations

Numeric
Support Clases

Object Layer
Tiled Maps

Physics Sprite
Physics Environment

Place
Actions & Animations

Point
Support Classes

Polygon Shape
Physics Environment

Repeat
Actions & Animations

Rotate
Actions & Animations

Scale
Actions & Animations

Scene
Essentials

Screen
Support Classes

Sequence
Actions & Animations

Shape
Physics Environment

Shuffle
Actions & Animations

Size
Support Classes

Skew
Actions & Animations

Spawn
Actions & Animations

Split
Actions & Animations

Sprite
Essentials

Sprite Batch
Essentials

Sprite Frame Cache
Essentials

Tile Layer
Tiled Maps

Tile Map
Tiled Maps

Tile Set
Tiled Maps

Tint
Actions & Animations

Touch
Support Classes

Turn
Actions & Animations

Twirl
Actions & Animations

Visibility
Actions & Animations

Wave
Actions & Animations

Wiggle
Actions & Animations

World
Physics Environment

PHYSICS ENVIRONMENT

Mass Data

Represents the computed mass of a Shape or a Body.

For more information, see: Shape documentation page

For more information, see: Body documentation page

Watch out!

In order to update the Body, first its needed to retrieve it from its Mass Data method, change the desired values and finally set it again. But be careful it contains a lot of consistency validations.

Mass

Gets or Sets the Mass in Kilograms:

mass_data.mass = 2.5

p "The Mass Data mass is: #{mass_data.mass}"

Center

Retrieve or Updates the Mass Data centroid in relationship to the origin:

mass_data.center = [10, 10]
center = mass_data.center

p "The Mass Data center is: #{center.x}, #{center.y}"

Metric Center

Gets or Sets the Mass Data center in Metric Coordinates.

Rotational Inertia

Gets or Sets the Mass Data Rotational Inertia:

mass_data.rotational_inertia = 1.2

p "The Mass Data rotational inertia is: #{mass_data.rotational_inertia}"