Scripting API

Scripting API

Rigidbody2D

Struct in Abyss.Physics2D, from Abyss.Physics2D.

A body Physics 2D moves: by gravity, by what it meets and by what code does to it, its colliders — a BoxCollider2D and the others on the same entity, and those on the entities under it that have no Rigidbody 2D nearer — what it meets with. Its place is the entity's Transform, across X and Y, turned about Z; its velocities are what the last step left, and setting them is what code moves it by.

public struct Rigidbody2D

Remarks

Forces, impulses and a move to a place are asked of Physics2D, which applies them at the next step. An entity with colliders and no body at or above it is ground: it does not move. A child with a Rigidbody 2D of its own is a body of its own.

Fields

Type

public BodyType2D Type

How it moves.

UseAutoMass

public bool UseAutoMass

Whether its mass is worked out from its colliders, each its size times its Density, rather than Rigidbody2D.Mass, which the step then says it was.

Mass

public float Mass

Its mass, in kilograms, whatever its colliders' sizes; what they make it where it uses auto mass.

GravityScale

public float GravityScale

How much of gravity pulls it: 1 all, 0 none, -1 upwards.

LinearDamping

public float LinearDamping

How quickly its moving slows of itself, as in air.

AngularDamping

public float AngularDamping

How quickly its turning slows of itself.

FreezeRotation

public bool FreezeRotation

Whether it never turns, as a character standing up does not.

Interpolate

public Interpolation2D Interpolate

Whether it is drawn between fixed steps.

CollisionDetection

public CollisionDetection2D CollisionDetection

How it is kept from passing through what it meets.

LinearVelocity

public Vector2 LinearVelocity

How fast it moves, in meters a second: what the last step left, and what code sets to move it.

AngularVelocity

public float AngularVelocity

How fast it turns, in degrees a second, anticlockwise.