A collider has a collision shape (box, sphere, capsule, ...) and is attached to a CollisionBody or RigidBody.
A body can have multiple colliders. The collider also have a mass value and a Material with many physics parameters like friction or bounciness. When you create a body, you need to attach at least one collider to it if you want that body to be able to collide in the physics world.
local collider = body:addCollider(shape, transform)
- Collider:getEntityId() number
- Collider:getCollisionShape() CollisionShape
- Collider:getBody() CollisionBody
- Collider:getUserData() table|nil
- Collider:setUserData(userData)
- Collider:getLocalToBodyTransform() Transform
- Collider:setLocalToBodyTransform(transform)
- Collider:getLocalToWorldTransform() Transform
- Collider:getWorldAABB() AABB
- Collider:testAABBOverlap(worldAABB) bool
- Collider:testPointInside(worldPoint) bool
- Collider:raycast(ray) RaycastInfo|nil
- Collider:getCollideWithMaskBits() number
- Collider:setCollideWithMaskBits(collideWithMaskBits)
- Collider:getCollisionCategoryBits() number
- Collider:setCollisionCategoryBits(collisionCategoryBits)
- Collider:getBroadPhaseId() number
- Collider:getMaterial() Material
- Collider:setMaterial(material)
- Collider:getMaterialBounciness() number
- Collider:setMaterialBounciness(bounciness)
- Collider:getMaterialFrictionCoefficient() number
- Collider:setMaterialFrictionCoefficient(frictionCoefficient)
- Collider:getMaterialMassDensity() number
- Collider:setMaterialMassDensity(massDensity)
- Collider:getIsTrigger() bool
- Collider:setIsTrigger(isTrigger)
Return the corresponding entity id of the collider.
RETURN
- (number)
Return the collision shape.
RETURN
Return the parent body.
RETURN
Return a table attached to this body or nil.
RETURN
- (table|nil)
Attach user data to this body.
PARAMETERS
userData
(table|nil)
Return the local to parent body transform.
RETURN
Set the local to parent body transform.
PARAMETERS
transform
(Transform)
Return the local to world transform.
RETURN
Return the AABB of the collider in world-space.
RETURN
- (AABB)
Test if the collider overlaps with a given AABB
PARAMETERS
worldAABB
(AABB)
RETURN
- (bool)
Return true if a point is inside the collision shape.
PARAMETERS
worldPoint
(vector3)
RETURN
- (bool)
Raycast method with feedback information. Retun (nil) if the ray not hits the collision shape
PARAMETERS
ray
(Ray)
RETURN
- (RaycastInfo|nil)
Return the collision bits mask.
RETURN
- (number)
Return the collision bits mask.
PARAMETERS
collideWithMaskBits
(number)
Return the collision category bits.
RETURN
- (number)
Set the collision category bits.
PARAMETERS
collisionCategoryBits
(number)
Return the broad-phase id.
RETURN
- (number)
Return a material properties of the collider.
RETURN
- (Material)
Set a new material for this collider.
PARAMETERS
material
(Material)
Return a bounciness properties of material.
RETURN
- (number)
Set a bounciness properties of material.
PARAMETERS
bounciness
(number)
Return a frictionCoefficient properties of material.
RETURN
- (number)
Set a frictionCoefficient properties of material.
PARAMETERS
frictionCoefficient
(number)
Return a massDensity properties of material.
RETURN
- (number)
Set a massDensity properties of material.
PARAMETERS
massDensity
(number)
Return true if the collider is a trigger.
RETURN
- (bool)
Set whether the collider is a trigger.
PARAMETERS
isTrigger
(bool)