bool valid
This value will be true if the object contains valid data.

vec2 pos
The current position of the body in the world.

uint id
The id of this body. This id is unique in the scene.

float angle
The current angle of the body in radians.

void select()
Selects the body.

void deselect()
Deselects the body.

bool isSelected()
Returns true if the body is currently selected.

string getName()
Returns the name of the body.

void setName(string)
Sets the name of the body. Names will be included in the saved file so that items can be identified when loading the scene into another program.

The same name can be given to more than one item.

void setType(int)
Sets the type of the body. The parameter can be one of the following values:

void setPosition(float x, float y)
Sets the position of the body.

void setPos(float x, float y)
Sets the position of the body.

void setPosition(vec2)
Sets the position of the body.

void setPos(vec2)
Sets the position of the body.

void setAngle(float)
Sets the angle of the body.

void setGravityScale(float)
Sets the gravity scale of the body.

void setAngularVelocity(float)
Sets the angular velocity of the body in radians.

void setLinearDamping(float)
Sets the linear damping value for the body.

void setAngularDamping(float)
Sets the angular damping value for the body.

void setLinearVelocity(float x, float y)
Sets the linear velocity for the body.

void setLinearVelocity(vec2)
Sets the linear velocity for the body.

void setBullet(int)
Sets whether the body will be a 'bullet' body, using continuous collision detection.

void setFixedRotation(int)
Sets whether the body will be have a fixed rotation.

void setSleepingAllowed(int)
Sets whether the body will be able to sleep when inactive.

void setAwake(int)
Sets whether the body is currently awake.

void setActive(int)
Sets whether the body is currently active.

void setMass(float)
Sets the overall mass of the body by adjusting the density of fixtures. This function will fail if the body has no fixtures, or only edge type fixtures (line/loop).

fixture addFixture(int fixtureId, string fixtureDefinition)
Adds a fixture with the given id to the body. The features of the body will be taken from the specified JSON string. If the given id is -1, the next available id will be used. If the given id is not -1 and is already in use, the next available id will be used and a warning will be printed to the console.

void delete()
Deletes the body. Any joints attached to the body will also be deleted.

vec2 getWorldPoint(vec2)
Returns the position in world coordinates of the given local coordinate location.

vec2 getLocalPoint(vec2)
Returns the position in local coordinates of the given world coordinate location.

vec2 getWorldVector(vec2)
Returns the vector in world coordinates of the given local coordinate vector.

vec2 getLocalVector(vec2)
Returns the vector in local coordinates of the given world coordinate vector.

vec2 getWorldCenter()
Returns the location of the center of mass of the body in world coordinates.

vec2 getLocalCenter()
Returns the location of the center of mass of the body in local coordinates.

fixture[] getFixtures()
Returns a list of the fixtures attached to the body.

image[] getImages()
Returns a list of the images attached to this body.

joint[] getJoints()
Returns a list of all joints connected to this body.

joint[] getJoints(body)
Returns a list of all joints between this body and the body given in the parameter.

string[] getCustomProperties()
Returns an array of the names of all custom properties for which a value actually exists.

bool hasCustomProperty(string propertyName)
Returns true if a value exists for the named property.

string getCustomPropertyType(string propertyName)
Returns the type of the named custom property. This will be one of int, float, string, vec2 or bool.

int getCustomInt(string propertyName, int defaultValue = 0)
Returns the value of the named custom property if it exists. If not, the optional default value will be returned. You can use hasCustomProperty to check if a value exists.

float getCustomFloat(string propertyName, float defaultValue = 0)
Returns the value of the named custom property if it exists. If not, the optional default value will be returned. You can use hasCustomProperty to check if a value exists.

string getCustomString(string propertyName, string defaultValue = "")
Returns the value of the named custom property if it exists. If not, the optional default value will be returned. You can use hasCustomProperty to check if a value exists.

vec2 getCustomVec2(string propertyName, vec2 defaultValue)
Returns the value of the named custom property if it exists. If not, the given default value will be returned. You can use hasCustomProperty to check if a value exists.

vec2 getCustomVec2(string propertyName)
Returns the value of the named custom property if it exists. If not, the vector 0,0 will be returned.

bool getCustomBool(string propertyName, bool defaultValue = false)
Returns the value of the named custom property if it exists. If not, the optional default value will be returned. You can use hasCustomProperty to check if a value exists.

vec2 getCustomColor(string propertyName, color defaultValue)
Returns the value of the named custom property if it exists. If not, the given default value will be returned. You can use hasCustomProperty to check if a value exists.

vec2 getCustomColor(string propertyName)
Returns the value of the named custom property if it exists. If not, the color 255,255,255,255 will be returned.

void setCustomInt(string propertyName, int)
Sets the value of the named custom property.

void setCustomFloat(string propertyName, float)
Sets the value of the named custom property.

void setCustomString(string propertyName, string)
Sets the value of the named custom property.

void setCustomVec2(string propertyName, vec2)
Sets the value of the named custom property.

void setCustomBool(string propertyName, bool)
Sets the value of the named custom property.

void setCustomColor(string propertyName, color)
Sets the value of the named custom property.

void clearCustomProperty(string propertyName)
Removes all values for the named custom property.

int getType()
Gets the type of the body. The returned value will be one of the following values:

bool isBullet()
Returns true if the body is a bullet body.

bool isFixedRotation()
Returns true if the body is a fixed rotation body.

bool isSleepingAllowed()
Returns true if the body is allowed to sleep.

bool isAwake()
Returns true if the body is currently awake.

bool isActive()
Returns true if the body is currently active.

vec2 getLinearVelocity()
Returns the current linear velocity of the body.

float getAngularVelocity()
Returns the current angular velocity of the body.

float getLinearDamping()
Returns the linear damping of the body.

float getAngularDamping()
Returns the angular damping of the body.

float getGravityScale()
Returns the gravity scale of the body.

float getMass()
Returns the mass of the body.