createProximityAction
Creates a proximity action attached to the player.
Syntax
player.createProximityAction(options, 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 = player.createProximityAction(
{
position: [3, 2, 3],
label: 'Nice music',
description: 'Play a sound',
key: 'KeyF',
distance: 3,
},
'my-custom-id',
);
// listen to the proximity action trigger
proximityAction.on(event => {
console.log('Proximity action triggered', event);
});
Available on: Client