Skip to content

Extended from StaticObject PhysicalObject

This class is used to create objects with physics

Properties

Vector2 Force

Is the force which is applied in the moment to the object

Vector2 Velocity

Is the velocity applied to the object

Vector2 Acceleration

Defines the rate of change of velocity for the physical object, initially set to zero.

table Collisions

This table stores all the active collisions

{ }

table CollisionBlacklist

This dictionary stores all the blacklisted objects, to blacklist an object do it like this:

CollisionBlacklist[object.Id] = true

{ }

table Hitbox

This the CollisionMask of the object

{ }

string Shape

Specifies the geometric shape of the physical object, which can be "circle" and "custom" for polygons, custom is has box hitbox by default, also is the default shape.

number Mass

The object mass

number HitboxScale

Change this property to change the hitbox size, the default value is 1

number CollisionGroup

A number which indicates the collision group of the object, the object only can collide with other objects with the same CollisionGroup

number Friction

Determines the resistance to sliding motion between this object and another surface, influencing how quickly it slows down.

boolean Anchored

This property defines if the object should have physics or not

boolean CanCollide

This property defines if the object can collide with other objects

boolean IsGrounded

This property indicates if the object is touching the ground

boolean TrackCollisions

This property defines if the object is going to have physics and collisions or not

Methods

void ApplyForce(force: Vector2)

Applies force to the object

Events

Name
Description
Collision Params -> PhysicalObject
This event is fired when the object collides with other object
CollisionEnd Params -> PhysicalObject
This event is fired when the object finish the collision with other object