BoxCollider

The box collider is an axis-aligned rectangle that is used for collision detection. The collider positions itself based on the entity's Transform position.

Properties:

PropertyTypeFunctionality
widthintThe width of the collider.
heightintThe height of the collider.
offsetvec2An offset of the origin. The origin is based on the Transform position [x, y].
bCollidingboolA flag used to inform if the collider is touching another collider.

Use Example:

-- Create a new entity, if not already created. local entity = Entity("tag", "group") -- Add a new transform component at position [50, 50], scale of 1 and no rotation. local boxCollider = entity:add_component( BoxCollider( 32, -- width 32, -- height vec2(0, 0) -- offset ) )