Skip to main content

createPlayerProximityAction

Creates a proximity action attached to a player.

Syntax

engine.world.createPlayerProximityAction(player, action, withId);

Parameters

NameTypeDescription
playernumber or PlayerManagerThe player to attach the proximity action to.
action (optional)ProximityActionOptionsThe proximity action options.
withId (optional)stringThe id of the proximity action.

Returns

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