createPlayerProximityAction
Creates a proximity action attached to a player.
Syntax
engine.world.createPlayerProximityAction(player, action, withId);
Parameters
Name | Type | Description |
---|---|---|
player | number or PlayerManager | The player to attach the proximity action to. |
action (optional) | ProximityActionOptions | The proximity action options. |
withId (optional) | string | The id of the proximity action. |
Returns
ProximityActionManager
- The proximity action manager.
Example
// create a proximity action
engine.world.createPlayerProximityAction(
player,
{
position: [3, 2, 3],
label: 'Nice music',
description: 'Play a sound',
key: 'KeyF',
distance: 3,
},
'my-custom-id',
);
// listen for proximity action triggers
engine.world.on('onProximityActionTriggered', event => {
console.log('Proximity action triggered', event);
});
Available on: Client