Skip to main content
Skip table of contents

Writing OKO Scripts - API Bindings

EntitySystem Bindings

Binding name

Description

getEntities

getObjects

getAvatars

getIndexOfEntity

getEntityById

getEntityByName

Returns an array of all entities

Returns the array of object entities (no avatars)

Returns the array of avatar entities (no objects)

Returns the index in the array of a given entity

Returns an entity that matches a given Id

Returns an entity that matches a given name

Entity Bindings

Binding name

Description

subscribeToPropertyChange

subscribeToMessage

postMessage

claimOwnership

getComponents

getAnimatedModelComponents

getAudioComponents

getAvatarComponents

getButtonComponents

getCustomComponents

getECommerceComponents

getExternalLinkComponents

getFiducialComponents

getFogComponents

getImageComponents

getLightComponents

getPortalComponents

getSplineComponents

getStaticModelComponents

getVideoPlayerComponents

position

rotation

scale

id

name

Binds a function to fire when a specified property changes

Binds a function to fire when a specified message is received

Invokes a message

Attempts to assign ownership of the entity to the local client

Retrieves all components owned by the entity

Retrieves all animated model components owned by the entity

Retrieves all audio components owned by the entity

Retrieves all avatar components owned by the entity

Retrieves all button components owned by the entity

Retrieves all custom components owned by the entity

Retrieves all ecommerce components owned by the entity

Retrieves all external link components owned by the entity

Retrieves all fiducial components owned by the entity

Retrieves all fog components owned by the entity

Retrieves all image components owned by the entity

Retrieves all light components owned by the entity

Retrieves all portal components owned by the entity

Retrieves all spline components owned by the entity

Retrieves all static model components owned by the entity

Retrieves all video player components owned by the entity

The position of the entity

The rotation of the entity

The scale of the entity

The ID of the entity

The name of the entity

Component Bindings

  • subscribeToPropertyChange

Animated Model Component

Binding name

Description

externalResourceAssetId

externalResourceAssetCollectionId

position

scale

rotation

isLoopPlayback

isPlaying

isVisible

animationIndex

Defines the asset ID for the asset

Defines the asset collection ID for the model asset

The position of the component

The scale of the component

The rotation of the component

Whether the animation loops upon reaching the end

Whether the animation is playing

Whether the component is visible

Index of the animation that should play

Audio Component

Binding name

Description

position

playbackState

audioType

audioAssetId

assetCollectionId

attenuationRadius

isLoopPlayback

timeSincePlay

volume

The position of the component

The current playback state [Reset, Pause, Play]

The type of audio component [Global, Spatial]

Defines the asset ID for the asset

Defines the asset collection ID for the audio asset

Distance from the component at which the audio volume attenuates

Whether the audio loops upon reaching the end

The time that has elapsed since the audio was last played

The volume of the audio

Avatar Space Component

Binding name

Description

avatarId

userId

state

avatarMeshIndex

agoraUserId

customAvatarUrl

isHandIKEnabled

targetHandIKTargetLocation

handRotation

headRotation

walkRunBlendPercentage

torsoTwistAlpha

avatarPlayMode

Defines the Id of the Avatar

Defines the ID of the user associated with this avatar component

The avatar anim state [Idle, Walking, Running, Flying, Jumping, Falling]

An index denoting which of the baked-in avatars is to be used

The Agora user ID associated with the avatar

If a custom avatar is being used, the URL for the mesh

Whether hand IK is enabled for the avatar

The target hand IK location

The current hand orientation

The current head orientation

0-1 scalar value controlling the blend between walking and running

Value defining the amount of torso twist

The avatar play mode [Default, AR, VR, Creator]

Button Component

Binding name

Description

labelText

iconAssetId

assetCollectionId

position

scale

rotation

isVisible

isEnabled

The text string to display on the button

Defines the asset ID for the asset

Defines the asset collection ID for the button asset

The position of the component

The scale of the component

The rotation of the component

Whether the the component visible

Whether the component enabled

Conversation Component

Binding name

Description

isVisible

isActive

position

rotation

Whether the component is visible

Whether the component is active

The position of the component

The rotation of the component

Custom Component

Binding name

Description

applicationOrigin

getCustomPropertySubscriptionKey

hasCustomProperty

removeCustomProperty

getCustomProperty

GetCustomPropertyKeys

setCustomProperty

A string identifying the author client application

Get the hash of the of the specified key

Query whether a custom property exists by name

Remove a custom property specified by name

Get a custom property specified by name

Get all set custom property keys

Set a custom property specified by name

ECommerce Component

Binding name

Description

position

productId

The position of the component

The Id of the Product associated with the component

External Link Component

Binding name

Description

name

linkUrl

displayText

position

scale

rotation

isEnabled

isVisible

Component name

The external URL associated with the component

The text to display on the external link in the space

The position of the component

The scale of the component

The rotation of the component

Whether the component is enabled

Whether the component is visible

Fiducial Marker Component

Binding name

Description

name

MarkerAssetId

position

scale

rotation

isVisible

The position of the component

The Id of the Product associated with the component

The position of the component

The scale of the component

The rotation of the component

Whether the component is visible

Fog Component

Binding name

Description

fogMode

position

scale

rotation

startDistance

endDistance

color

density

heightFalloff

maxOpacity

isVolumetric

Component name

The position of the component

The scale of the component

The rotation of the component

Distance from the component at which the fog starts

Distance from the component at which the fog ends

The color of the fog

The density of the fog

The height at which the fog falls off

The maximum opacity of the fog

Whether the fog is volumetric

Image Component

Binding name

Binding name

name

imageAssetId

position

scale

rotation

billboardMode

displayMode

isEmissive

isVisible

Component name

Defines the asset ID for the asset (retrieved via asset system)

The position of the component

The scale of the component

The rotation of the component

The image billboard mode [Off, Billboard, YawLockedBillboard]

The image display mode [SingleSided, DoubleSided, DoubleSidedReversed]

Whether the component is emissive

Whether the component is visible

Light Component

Binding name

Description

lightType

Intensity

range

innerConeAngle

outerConeAngle

position

rotation

color

isVisible

cookieAssetId

lightCookieType

What kind of light is this (point, spot)

The intensity of the light (units are lumens)

The distance over which the light attenuates

Spotlight only! Defines the inner cone angle

Spotlight only! Defines the outer cone angle

The position of the component

The rotation of the component

The RGB color of the light

Whether the component is visible

Defines the Id of the cookie asset

The type of cookie you want to use [None, Image]

Portal Component

Binding name

Description

spaceId

isEnabled

position

radius

Defines the Id of the space the user will travel to

Whether the component is enabled

The position of the component

The radius of the portal

Spline Component

Binding name

Description

setWaypoints

getWaypoints

getLocationAlongSpline

Set Vector3 waypoints to generate the spline

Get Vector3 waypoints used to generate spline

Get Vector3 at chosen position along the spline

Static Model Component

Binding name

Description

externalResourceAssetId

externalResourceAssetCollectionId

position

scale

rotation

isVisible

Defines the asset ID for the asset

Defines the asset collection ID for the model asset

The position of the component

The scale of the component

The rotation of the component

Whether the component is visible

Video Player Component

Binding name

Description

name

position

scale

rotation

videoAssetId

videoAssetURL

assetCollectionId

isStateShared

isAutoPlay

isLoopPlayback

isAutoResize

attenutationRadius

playbackState

currentPlayheadPosition

timeSincePlay

videoPlayerSourceType

isVisible

isEnabled

Component name

The position of the component

The scale of the component

The rotation of the component

Defines the ID for the asset

Instead of uploading a video asset an external URL can be specified

Defines the ID for the asset collection for the video asset

Whether playback state is replicated

Whether the video should auto play

Whether the video loops upon reaching the end

Whether the component should resize to match the video aspect ratio

Distance from the component at which the audio volume attenuates

The current playback state [play, pause, stop]

The current timestamp of the video’s play head

The time that has elapsed since the video was last played

The video source type [URLSource, AssetSource, WowzaStreamSource]

Whether the component is visible

Whether the component is enabled

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.