0.8.0Main class for creating a HubsBot. Dynamically adds all methods from InBrowserBot, which can be called directly from a HubsBot instance.
Extends EventEmitter
var bot = new HubsBot();
bot.goTo(0, 1, 0) // goTo is a InBrowserBot method, but can be called directly on the HubsBot
Launches the puppeteer browser instance. It is not necessary to call this directly in most cases. It will be done automatically when needed.
Enters the room specified, enabling the first microphone and speaker found
Creates an InBrowserBotBuilder to allow building a bot for use in the developer console.
(Function)
The function to execute in the browser context. The
this
passed to fn will be an InBrowserBot version of this bot. If
this bot is a subclass of HubsBot, the subclassed definitions will
be injected into the built
InBrowserBot
code.
(...any)
Arguments to be serialized and passed to fn
InBrowserBotBuilder:
An InBrowserBotBuilder which can be used to
create client-side code to execute
fn
. This code can then be copied and
pasted into the developer console
Leaves the room and closes the browser instance without exiting node
Functionality that executes in the context of the browser.
Extends EventTarget
Placeholder to not break scripts. InBrowserBots cannot enter or switch rooms
(any)
Sets an attribute on the avatar rig
(any)
(any)
Creates an interactive object, similar to the user's magic wand functionality.
(Object
= {})
| Name | Description |
|---|---|
opts.url string
|
The url to the media (e.g., a .glb or png file) |
opts.scale (string | Object | THREE.Vector3)
|
The x,y,z scale of the object once it's created |
opts.position (string | Object | THREE.Vector3)
|
Where to place the object |
opts.rotation (string | Object | THREE.Euler3)
|
The orientation in which to place the object |
opts.dynamic boolean
|
If true, the objet will be subject to physics while owned by the bot (it will not be subject to physics if grabbed by a user) |
opts.autoDropTimeout Number
|
If greater than zero, the amount of time to wait after an object has stopped moving before the bot will seize ownership and reapply physics. This helps work around the fact that dynamic state doesn't propogate to other users. |
opts.fitToBox boolean
|
Whether the spawned object should be fit into a box (like with the magic wand). When false, it will use the object's native size. |
opts.pinned boolean
|
Whether this object should be pinned to the room. Note: since bot authentication is currently unsupported, pinned objects will disappear once the bot disconnects. |
Sets the name of the bot. NOTE in order to help prevent abuse, the name will be previxed with "bot - "
(any)
Name that will be displayed in the room over the bot's head
Sets the avatar that the bot should use.
(any)
URL pointing to a gltf file for the avatar. Needs to be CORS accessible
Posts a message to the chat
(any)
Makes the bots hands visible and controllable
Sets the transformations of various avatar components. Currently, all parameters must be specified.
(any)
| Name | Description |
|---|---|
opts.leftHand any
|
|
opts.leftHand.position (Object | THREE.Vector3)
|
Position of the left hand |
opts.leftHand.rotation (Object | THREE.Euler)
|
Rotation of the left hand |
opts.rightHand any
|
|
opts.rightHand.position (Object | THREE.Vector3)
|
Position of the right hand |
opts.rightHand.rotation (Object | THREE.Euler)
|
Rotation of the right hand |
opts.head any
|
|
opts.head.position (Object | THREE.Vector3)
|
Position of the head |
opts.head.rotation (Object | THREE.Euler)
|
Rotation of the head |
Converts a HubsBot into an InBrowserBot. This should not be used directly, but rather accessed through HubsBot.asBrowserBot
(any)
(any)
(...any)