createProximityAction
Creates a proximity action.
Syntax
engine.world.createProximityAction(action, withId);
Parameters
Name | Type | Description |
---|---|---|
options (optional) | ProximityActionOptions | The options to create the proximity action. |
withId (optional) | string | The id of the proximity action. |
Returns
ProximityActionManager
- The proximity action manager.
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