Collider:set_categories

Sets which physics categories describe this collider.

Categories are used to determine which colliders and sensors are allowed to interact with each other. The list of valid categories in your project must be defined using crystal.configure.

Usage

collider:set_categories(...)

Arguments

Name Type Description
... string Physics categories describing this collider.

Examples

local ecs = crystal.ECS:new();
ecs:add_system(crystal.PhysicsSystem);

local monster = ecs:spawn(crystal.Entity);
monster:add_component(crystal.Body);
monster:add_component(crystal.Collider, love.physics.newCircleShape(4));
monster:set_categories("characters");
monster:enable_collision_with("level", "characters");
monster:disable_collision_with("powerups", "traps");

This site uses Just the Docs, a documentation theme for Jekyll.