Collider¶
Class ยท server and client scripts
Collider defines the collision shape, trigger behavior, physical surface overrides, assembly membership, and contact signals of an entity. Access it through entity.Collider after adding Component.Collider.
Kind¶
Kind sets the collision shape: "Auto" follows the visual Shape (Box, Sphere, Cylinder, or Wedge), or pick "Box", "Sphere", "Cylinder", "Wedge", or "Capsule" explicitly.
Default "Auto"
Trigger¶
Trigger turns the collider into a non-solid sensor volume that lets bodies pass through while firing Touched and TouchEnded.
Default false
Example
Enabled¶
Enabled turns collision tests on or off for this collider without removing the component.
Default true
Friction¶
Friction overrides the surface friction of this collider. Call ClearMaterial to revert back to the part's material.
Restitution¶
Restitution overrides the bounciness (0 to 1) of this collider. Call ClearMaterial to revert back to the part's material.
Density¶
Density overrides the mass density of this collider. Call ClearMaterial to revert back to the part's material.
Root¶
Root is the root entity of the welded physics assembly that contains this collider, settling pending welds made on the current tick.
ClearMaterial¶
ClearMaterial removes per-collider Friction, Restitution, and Density overrides so the collider inherits values from its surface material again.
Members¶
Members returns an array of every entity in this collider's welded physics assembly, settling pending welds made on the current tick.
Detach¶
Detach breaks this collider off its welded assembly on the server so it and its descendants simulate as a separate body.
Touched¶
Touched fires with the other entity when this collider begins overlapping another collider. Connect with entity:On(Component.Collider.Touched, fn).
Example
TouchEnded¶
TouchEnded fires with the other entity when this collider stops overlapping another collider. Connect with entity:On(Component.Collider.TouchEnded, fn).
Hit¶
Hit fires during a physics step with (other, position, normal, speed) when this collider impacts another body. Connect with entity:On(Component.Collider.Hit, fn).