class
Collider
Physics object that can be interacted with in the physics world.
It can either block other physics objects, or act as a trigger. Trigger will report collision events, but won't actually prevent other physical objects from going through them.
This object is intended to remain static in the world. You /can/ move it, but it will not interact with the physics world correctly when moved. For that case use Rigidbody instead.
Public
Constructors
Collider
Methods
~Collider
SetIsTrigger
Determines if the collider is a trigger.
Trigger collider will not prevent objects from going through its shapes but it will still report collision events.
GetIsTrigger
SetMass
Determines the mass of the collider shape.
Only relevant if the parent collider is part of a rigidbody. Ultimately this will determine the total mass, center of mass and inertia tensors of the parent rigidbody (if they're being calculated automatically).
GetMass
SetMaterial
Determines the physical material of the collider shape.
The material determines how objects hitting the collider shape.
GetMaterial
SetContactOffset
Determines how far apart do two shapes need to be away from each other before the physics runtime starts generating repelling impulse for them.
This distance will be the sum of contact offsets of the two interacting objects. If objects are moving fast you can increase this value to start generating the impulse earlier and potentially prevent the objects from interpenetrating. This value is in meters. Must be positive and greater than rest offset.
Also see SetRestOffset().
GetContactOffset
SetRestOffset
Determines at what distance should two objects resting on one another come to an equilibrium.
The value used in the runtime will be the sum of rest offsets for both interacting objects. This value is in meters. Cannot be larger than contact offset.
Also see SetContactOffset().
GetRestOffset
SetLayer
Determines the layer of the collider shape.
Layer controls with which shapes will this shape collide.
GetLayer
SetCollisionReportMode
Determines which (if any) collision events are reported.
GetCollisionReportMode
GetRigidbody
Determines the Rigidbody that controls this collider (if any).
GetShapes
Returns all the shapes associated with this collider.
RayCast
Checks does the ray hit this collider.
- ray
- Ray to check.
- outHit
- Information about the hit. Valid only if the method returns true.
- maximumDistance
- Maximum distance from the ray origin to search for hits.
Returns: True if the ray has hit the collider.
RayCast
Checks does the ray hit this collider.
- origin
- Origin of the ray to check.
- direction
- Unit direction of the ray to check.
- outHit
- Information about the hit. Valid only if the method returns true.
- maximumDistance
- Maximum distance from the ray origin to search for hits.
Returns: True if the ray has hit the collider.
staticGetRttiStatic
Fields
OnCollisionBegin
Triggered when some object starts interacting with the collider.
Only triggered if proper collision report mode is turned on.
OnCollisionStay
Triggered for every frame that an object remains interacting with a collider.
Only triggered if proper collision report mode is turned on.
OnCollisionEnd
Triggered when some object stops interacting with the collider.
Only triggered if proper collision report mode is turned on.
Internal
Methods
GetAdjustedPosition
GetAdjustedRotation
Protected
Constructors
Collider
Methods
OnCreated
Called once when the component has been created.
Called regardless of the state the component is in.
OnDestroyed
Called once just before the component is destroyed.
Called regardless of the state the component is in.
OnDisabled
Called every time a component is placed into the Stopped state.
This includes component destruction if component wasn't already in Stopped state during destruction. When called during destruction it is called before OnDestroyed.
OnEnabled
Called every time a component leaves the Stopped state, if the component is enabled.
This includes component creation if requirements for leaving the Stopped state are met. When called during creation it is called after OnBeginPlay.
OnTransformChanged
Called when the component's parent scene object has changed.
Not called if the component is in Stopped state. Also only called if necessary notify flags are set via SetNotifyFlagsInternal().
IsValidParent
Checks is the provided rigidbody a valid parent for this collider.
SetRigidbody
Changes the rigidbody parent of the collider.
When set all shapes are parented to this rigidbody instead of the body backed by internal collider implementation. Returns true if the provided rigidbody is different from existing one.
UpdateTransform
Updates the transform of the internal collider representation from the transform of the component's scene object.
Optionally also updates all shape transforms as they may have changed if they depend on the parent.
UpdateCollisionReportMode
Applies the collision report mode to the internal collider depending on the current state.
RefreshParentRigidbody
Searches the parent scene object hierarchy to find a parent Rigidbody component, and determines if shapes need to be detached/attached if the parent rigidbody changed, was added or removed.
Returns true if parent changed.