Collider2DExtensions¶
Namespace:
SideXP.Core
Extension functions for Collider2D components. See ColliderExtensions for 3D colliders.
Methods¶
GetColliderBounds(Collider2D)¶
Returns
Returns the collider bounds.
GetColliderBounds(Collider2D, Bounds)¶
Gets the bounds of a collider.
Parameters
collider: The collider of which to query the bounds.bounds: Outputs the collider bounds.
Returns
Returns true if the collider type is supported (box, sphere, capsule, or mesh with a shared mesh).
Remarks
While the game is running, the physics system provides accurate world bounds through bounds. At edit time (or for a prefab) that representation isn't baked, and reading it (even through the concrete collider type) returns a zeroed value. In that case the bounds are computed from the collider's geometry (center/size/radius/mesh) transformed into world space instead. Note: for a rotated non-box collider the computed AABB is slightly looser than the physics one.
GetColliderOffset(Collider2D)¶
Gets the offset of a Collider2D.
Parameters
collider: The collider to check.
Returns
Returns the found collider offset.
GetColliderOffset(Collider2D, Vector2)¶
Gets the offset of a Collider2D.
Parameters
collider: The collider to check.offset: Outputs the found collider offset.
Returns
Returns true if the offset has been queried successfully.