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, also affects collision response distribution between objects
number GravityScale¶
Multiplier for gravity. Defaults to 1. Set to 0 to disable gravity for this object
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.
number AngularVelocity¶
The rotational speed of the object in degrees per second.
number AngularFriction¶
Determines how quickly the angular velocity decays over time.
number AngularScale¶
Multiplier for collision-generated spin. Defaults to 0 (disabled). Set to 1 or higher to enable angular physics.
number AngularStiffness¶
How strongly the object snaps to stable angles when grounded. Higher = faster settling, lower = more wobbly. Set to 0 to disable auto-stabilization.
number Torque¶
The rotational force applied to the object this frame.
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
void ApplyTorque(torque: number)¶
Applies torque to the object (rotational force in degrees/s²)
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 |