CircleCollider
The circle collider 2D circle that is used for collision detection. The collider positions itself based on the entity's Transform position.
Properties:
Property | Type | Functionality |
---|---|---|
radius | float | The radius of the circle collider. |
offset | vec2 | An offset of the origin. The origin is based on the Transform position [x, y]. |
bColliding | bool | A 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 circleCollider = entity:add_component(
CicleCollider(
16, -- radius
vec2(0, 0) -- offset
)
)