Skip to main content

collider_active_collision_types

By default, collision-detection is completely disabled between two colliders when both are attached to non-dynamic bodies. Sometimes, it can be useful to enable collision-detection between, e.g., a collider attached to a kinematic rigid-body and a collider attached to a fixed rigid-body. This can be done by modifying the collider's ActiveCollisionTypes:

/* Set the active collision types when the collider is created. */
let colliderDesc = RAPIER.ColliderDesc.ball(0.5)
.setActiveCollisionTypes(RAPIER.ActiveCollisionTypes.DEFAULT |
RAPIER.ActiveCollisionTypes.KINEMATIC_FIXED);
let collider = world.createCollider(colliderDesc);
/* Set the active collision types after the collider creation. */
collider.setActiveCollisionTypes(RAPIER.ActiveCollisionTypes.DEFAULT |
RAPIER.ActiveCollisionTypes.KINEMATIC_FIXED);
info

To enable collision-detection between kinematic bodies and fixed bodies (as well as dynamic bodies), set its active collision types to:

RAPIER.ActiveCollisionTypes.DEFAULT | RAPIER.ActiveCollisionTypes.KINEMATIC_FIXED