How to pick up object with spacebar?

How to make an object that can be picked up with a spacebar? Like this?
Gather Town pick up object

1 Like

Same question here too…

The answer here is through custom extensions using the websocket API. You can use the spacebar input to trigger a check for what a player is standing nearest to, then add that image to their character as a held item. Then you do the reverse to put it down. There is not currently default support for spacebar interactions outside of the Escape Room.


Thanks Bill_Uncork-it! Where can I learn about the websocket api. Appreciate the pointers!

Here, the discord, and the API office hours are a good start. However, none of these are “beginner” level sources, as they all assume a level of understanding JS,TS, npm, etc.

1 Like

Is there any sample can show how to useing the extension of the websocket API?
Or the document of official websocket API have any explane about it?

I cant exactly give you the actual code, as there are a lot of considerations as to player behavior, object preferences, etc, but from a pseudo-code standpoint, you would:

Connect to the space using game.connect()

Set up a subscription to the 'playerTriggersItem' event

Inside the event, code for if they are allowed to pick up the item. If they are, add it to their character.

Also check if they already have an item, and if they do, drop it, or maybe swap it with the other close one.

When they pick up an item, be sure to delete the object on the ground too. (Unless multiple can be picked up)

When they drop an item, create an item with the proper characteristics on the ground, somewhere.

Technically, those are all the parts you would need for spacebar interactions.

Edit: didnt expect the bolded words, those don’t mean anything specific.


Fantastic! Thank you
I will try it.