Skip to content

AI Proximity

Updated

Detects when the active camera enters or leaves this box.

Type
comp-ai-proximity
Script class
AIProximityComponent
Per entity
One
Version
1.0.0

Read about it in Dialog and captions: what it does, how to use it from a script, and examples.

The props the runtime declares for this component, with their defaults and accepted ranges.

Prop Default Range
halfExtents
halfExtents.x 0.001 ≤ x ≤ 10000
halfExtents.y 0.001 ≤ x ≤ 10000
halfExtents.z 0.001 ≤ x ≤ 10000

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • AIProximity::enter
  • AIProximity::exit

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(AIProximityComponent);
if (component) log(component.props);
}