Skip to main content

createProximityAction

Creates a proximity action.

Syntax

engine.world.createProximityAction(action, withId);

Parameters

NameTypeDescription
options (optional)ProximityActionOptionsThe options to create the proximity action.
withId (optional)stringThe id of the proximity action.

Returns

Example

// create a proximity action
const proximityAction = engine.world.createProximityAction({
id: 'my-id',
position: [3, 2, 3],
label: 'Nice music',
description: 'Play a sound',
key: 'KeyF',
distance: 3,
});

// listen to the proximity action trigger
proximityAction.on(event => {
console.log('Proximity action triggered', event);
});

Available on: Client