Skip to main content

SpecsInteractionModule.Overlap

Class

One collider inside an overlap probe's volume, with an id stable from the enter to the exit of that membership.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
  • SnapchatNot supported — Available on SPECS only
  • SPECSFully supported
  • Camera Kit WebNot supported — Available on SPECS only
  • Camera Kit MobileNot supported — Available on SPECS only

Platform details

  • Snapchat — Not supported — Available on SPECS only.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported — Available on SPECS only.

  • Camera Kit Mobile — Not supported — Available on SPECS only.

Since Lens Scripting v375

One collider inside an overlap probe's volume, with an id stable from the enter to the exit of that membership. Delivered via OverlapEnterEventArgs#enteredOverlaps and OverlapExitEventArgs#exitedOverlaps.

Index

Example

probe.onOverlapEnter.add(function (args) {
args.enteredOverlaps.forEach(function (overlap) {
if (overlap.collider) {
print("entered " + overlap.id + ": " + overlap.collider.getSceneObject().name);
}
});
});

Extends

Properties

collider

readonly collider: ColliderComponent

SPECS

The collider. Null in OverlapProbe#onOverlapExit if the collider was destroyed while a member; use Overlap#id to correlate the exit with its enter.

Since

Lens Scripting Version 375


distance

readonly distance: number

SPECS

Closest-point distance from the collider's volume to the probe center, in centimeters; 0 when the probe center is inside the collider. -1 unless the probe was created with SpecsInteractionModule.OverlapProbeOptions#trackDistances enabled.

This Overlap is a live view, not a snapshot: while the collider stays inside a distance-tracking probe, the value refreshes in place once per frame at the probe's overlap evaluation (after Update, before LateUpdate), so read it in LateUpdate for current-frame-accurate results. Retain the Overlap from OverlapProbe#onOverlapEnter and poll this property; it resets to -1 when the membership exits (including during the OverlapProbe#onOverlapExit callback), so a retained Overlap never reads as still-near after leaving.

Since

Lens Scripting Version 375


id

readonly id: number

SPECS

Identifies this membership, stable from its enter to its exit and unique among the probe's concurrent memberships. Use it to pair an exit with its enter.

Since

Lens Scripting Version 375

Methods

getTypeName()

static getTypeName(): TypeName<Overlap>

SPECS

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<Overlap>

Since

Lens Scripting Version 375

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

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

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

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

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame