Exposes state generated for ColliderComponent overlap events. See also: ColliderComponent, OverlapEnterEventArgs, OverlapExitEventArgs, OverlapStayEventArgs.

// When the collider begins to overlap another collider, print information about the overlap

// @input Physics.ColliderComponent collider

script.collider.onOverlapEnter.add(function (e) {
var overlap = e.overlap;
print("OverlapEnter(" + overlap.id + "): Overlap with: " + overlap.collider.getSceneObject().name);
});
interface Overlap {
    collider: ColliderComponent;
    id: number;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
}

Hierarchy (view full)

Properties

The collider which is overlapping.

id: number

ID of the overlap, unique for this overlap.

Methods

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean