Skip to main content

createProximityAction

Creates a proximity action attached to the player.

Syntax

player.createProximityAction(options, 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 = 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