Scripting API

Collider

class in UnityEngine · UnityEngine.PhysicsModule · inherits from Component

15 of 19 of Unity's membersUnity's documentation
In Tassix

Base class for 3D colliders. A collider joins the nearest Rigidbody up its hierarchy, or is static. Its shape scales with the transform.

Properties 11

Rigidbody? attachedRigidbody { get; }

The nearest Rigidbody on this object or up its hierarchy.

Bounds bounds { get; }

World-space bounds of the shape.

float contactOffset { get; set; }
bool enabled { get; set; }
LayerMask excludeLayers { get; set; }

Layers this collider never contacts; its rigidbody's add to them.

LayerMask includeLayers { get; set; }

Layers this collider also contacts (past the layer matrix); its rigidbody's add to them.

bool isTrigger { get; set; }
int layerOverridePriority { get; set; }

Which collider's overrides win when two disagree (the higher; a tie means no contact).

PhysicsMaterial material { get; set; }

This collider's own copy of its material, made on first access.

bool providesContacts { get; set; }
PhysicsMaterial? sharedMaterial { get; set; }

The shared material; null means the default (friction 0.6, bounciness 0).

Methods 3

Vector3 ClosestPoint(Vector3 position)

The point on or in the collider nearest position (itself when inside). Boxes, spheres and capsules are exact; other shapes use their bounds.

Vector3 ClosestPointOnBounds(Vector3 position)

The point on the collider's world bounds closest to position.

bool Raycast(Ray ray, out RaycastHit hitInfo, float maxDistance)

A ray against this collider alone.

Not in Tassix yet 4

GeometryHolder GetGeometry attachedArticulationBody hasModifiableContacts