Appearance
Scene
Properties
cameraTransform
- Type: Transform
- Current camera transform in world space
id
- Type: string
- Scene identifier
microphone
- Type: Microphone
- Microphone audio streaming
time
- Type: number
- Time elapsed since scene started (seconds)
viewportSize
- Type: Vector2
- Viewport size in points (iOS only)
Methods
_removeEntity()
javascript
_removeEntity(): voidRemove an entity from the scene
Returns: void
animateBy()
javascript
animateBy(objectOrId: string | ObjectEntity, properties: Object, duration: number, options?: Object): Promise<void>Animate object by relative values
Parameters:
objectOrId(string | ObjectEntity) - ObjectEntity or entity IDproperties(Object) - Relative change valuesduration(number) - Animation duration in secondsoptions(Object) (optional) - Animation options
Returns: Promise<void>
animateFromTo()
javascript
animateFromTo(objectOrId: string | ObjectEntity, fromProperties: Object, toProperties: Object, duration: number, options?: Object): Promise<void>Animate object from starting to target properties
Parameters:
objectOrId(string | ObjectEntity) - ObjectEntity or entity IDfromProperties(Object) - Starting propertiestoProperties(Object) - Target propertiesduration(number) - Animation duration in secondsoptions(Object) (optional) - Animation options
Returns: Promise<void>
animateTo()
javascript
animateTo(objectOrId: string | ObjectEntity, properties: Object, duration: number, options?: Object): Promise<void>Animate object to target properties
Parameters:
objectOrId(string | ObjectEntity) - ObjectEntity or entity IDproperties(Object) - Target properties (position, rotation, scale, opacity)duration(number) - Animation duration in secondsoptions(Object) (optional) - Animation options (timingFunction, delay, repeatCount, etc.)
Returns: Promise<void>
createAudioStream()
javascript
createAudioStream(options: Array<any>): AudioStreamCreate a streaming audio player
Parameters:
options(Array<any>) - Stream configuration (sampleRate, channels, format, elementId, representationId)
Returns: AudioStream
createEntity()
javascript
createEntity(descriptor: ObjectDescriptor): Promise<ObjectEntity>Create an object in the scene.
Example:
javascript
const box = createBox(0.3, 0.3, 0.3)
.anchor(Anchor.position(0, 0, -1))
.name('hero-box');
const entity = await scene.createEntity(box);Parameters:
descriptor(ObjectDescriptor) - Object descriptor from createBox, createSphere, createModel, createPlane, createMesh, etc. Configure anchor, traits, name, etc. via the descriptor's builder methods (.anchor(...),.traits(...),.name(...)), not as a second argument.
Returns: Promise<ObjectEntity>
findEntity()
javascript
findEntity(query: any): ObjectEntityFind an entity by ID or name
Example:
javascript
// By ID
var entity = scene.findEntity("ABC123");
// By ID (explicit)
var entity = scene.findEntity({ id: "ABC123" });
// By name
var entity = scene.findEntity({ name: "My Cool Box" });Parameters:
query(any) - Entity ID string, or object with { id: "..." } or { name: "..." }
Returns: ObjectEntity
getAnchors()
javascript
getAnchors(kind?: string): Array<any>Get detected AR anchors
Parameters:
kind(string) (optional) - Filter by anchor type ("plane", "image", "face", etc.), or nil for all
Returns: Array<any>
getCustomEvents()
javascript
getCustomEvents(): Array<any>List custom-trigger scene events on the current segment. Useful for debug panels that enumerate triggerable events at runtime. Each entry has the event's id, optional name (omitted when unset), and isEnabled flag. System events (tap, render, screenTap, schedule, etc.) are not included – those are handled by the engine, not scripted.
Example:
javascript
scene.getCustomEvents().forEach(function(evt) {
console.log(evt.id, evt.name, evt.isEnabled);
});Returns: Array<any>
getVariable()
javascript
getVariable(id: string): anyGet a scene-scoped variable
Parameters:
id(string) - Variable identifier
Returns: any
off()
javascript
off(eventId: string): voidRemove a scene event listener
Example:
javascript
var eventId = scene.on('render', function() {});
// Later...
scene.off(eventId);Parameters:
eventId(string) - Event ID returned from on()
Returns: void
on()
javascript
on(type: string, options?: Object | function, listener?: function): stringRegister a scene event listener
Example:
javascript
scene.on('start', function() {
console.log('Scene started!');
});Parameters:
type(string) - Event type: "start", "render", "screenTap", "variableChange", "schedule"options(Object | function) (optional) - Event options or callbacklistener(function) (optional) - Callback if options provided
Returns: string
once()
javascript
once(type: string, options?: Object | function, listener?: function): stringRegister a one-time scene event listener
Example:
javascript
scene.once('start', function() {
console.log('Scene started (once)!');
});Parameters:
type(string) - Event typeoptions(Object | function) (optional) - Event options or callbacklistener(function) (optional) - Callback if options provided
Returns: string
playAnimation()
javascript
playAnimation(objectOrId: string | ObjectEntity, animation: Object, representationId?: string): Promise<void>Play animation on object
Parameters:
objectOrId(string | ObjectEntity) - ObjectEntity or entity IDanimation(Object) - Animation datarepresentationId(string) (optional) - Optional representation ID
Returns: Promise<void>
playAudioBuffer()
javascript
playAudioBuffer(base64: string, options?: Object): Promise<void>Play audio from PCM buffer data
Example:
javascript
// Play at user's position (non-spatial)
await scene.playAudioBuffer(base64Data, { sampleRate: 24000 });
// Play spatially on an entity
await scene.playAudioBuffer(base64Data, {
sampleRate: 24000,
elementId: box.id
});Parameters:
base64(string) - Base64-encoded PCM audio dataoptions(Object) (optional) - Buffer and playback optionsoptions.sampleRate(number) (optional) - Sample rate in Hzoptions.channels(number) (optional) - Number of channels (1 = mono, 2 = stereo)options.format(string) (optional) - Sample format: "pcm16" or "float32"options.gain(number) (optional) - Volume gain (0.0 to 4.0, default 1.0)options.elementId(string) (optional) - Target element ID (optional, uses POV if omitted)options.representationId(string) (optional) - Target representation ID (optional)
Returns: Promise<void>
projectToScreen()
javascript
projectToScreen(worldPosition: Vector3): Vector2Convert world position to normalized screen coordinates (iOS only)
Parameters:
worldPosition(Vector3) - Position in world space
Returns: Vector2
raycast()
javascript
raycast(origin: Vector3, direction: Vector3): Array<any>Cast ray through scene entities and scene mesh
Parameters:
origin(Vector3) - Ray origin in world spacedirection(Vector3) - Ray direction (will be normalized)
Returns: Array<any>
raycastAR()
javascript
raycastAR(origin: Vector3, direction: Vector3, target: string, alignment: string): Array<any>Cast ray against AR planes (iOS only)
Parameters:
origin(Vector3) - Ray origin in world spacedirection(Vector3) - Ray direction (will be normalized)target(string) - Target type - "plane", "planeExtended", "surface"alignment(string) - Surface alignment - "horizontal", "vertical", "any"
Returns: Array<any>
runAction()
javascript
runAction(action: Action): Promise<void>Run an action and wait for completion.
Parameters:
action(Action) - Action to run.
Returns: Promise<void>
screenToRay()
javascript
screenToRay(normalizedPosition: Vector2): RayConvert normalized screen coordinates to a ray for raycasting (iOS only)
Parameters:
normalizedPosition(Vector2) - Screen position in normalized coordinates (0-1)
Returns: Ray
setVariable()
javascript
setVariable(id: string, value: any, options: any): voidSet a scene-scoped variable (cleared on scene transition)
Parameters:
id(string) - Variable identifiervalue(any) - Value to store (number, string, boolean, Vector3, Color, etc.)options(any) - Optional type hint { type: "vector3" | "color" | ... }
Returns: void
triggerCustomEvent()
javascript
triggerCustomEvent(query: any): voidTrigger one or more custom-trigger events.
or { name: "..." }. Multiple events can share a name – passing { name: ... } fires all matches.
Example:
javascript
scene.triggerCustomEvent("evt-abc"); // by ID
scene.triggerCustomEvent({ id: "evt-abc" }); // by ID, explicit
scene.triggerCustomEvent({ name: "spawn-box" }); // by name (fires all matches)Parameters:
query(any) - Lookup form. Pass a string ID,{ id: "..." },
Returns: void
Internal API dev only
WARNING
These methods are internal implementation details and not part of the public API.
buildParameterValue() internal
javascript
buildParameterValue(value: any, typeHint?: any): anyInternal: build an ARXObjectMaterialInputParameter.value(...) JSON payload from a JS value + optional type hint. Reuses the same JSValue.toARXValue(typeHint:) conversion as setVariable so the type-inference vocabulary is identical. Authors call Material.setParameter(name, value, typeHint?); the runtime wraps this bridge to stuff the result into customShadersOptions.parameters or materialXOptions.parameters depending on the material's kind.
Parameters:
value(any)typeHint(any) (optional)
Returns: any
createAction() internal
javascript
createAction(jsonValue: any): ActionParameters:
jsonValue(any)
Returns: Action
createComputeBuffer() internal
javascript
createComputeBuffer(options: { elementType: "float32" | "uint32" | "uint8" | "atomic_uint", length: number, initialValue?: number }): BufferInternal bridge – JS authors use Buffer.float32(...) / Buffer.uint32(...) / Buffer.uint8(...) / Buffer.atomic(...). Allocates a CPU-visible GPU buffer so buffer.writeSync(...) and buffer.readSync() work without an explicit copy. Length is element count, not bytes.
Parameters:
options({ elementType: "float32" | "uint32" | "uint8" | "atomic_uint", length: number, initialValue?: number })
Returns: Buffer
createDynamicTexture() internal
javascript
createDynamicTexture(options: { kind, semantic?, ...kind-specific }, callback: (result, error)): voidInternal bridge – JS authors use Texture.compute({...}) (and future sibling factories like Texture.image(...)). Callback-based + _promisify-wrapped on the JS side so authors get a Promise<Texture>. Async because the asset-provider funnel handles all kinds uniformly (some kinds need real async work – image / video / etc.); compute-backed rides through the same funnel for cache registration so material binding resolves to the same manager later.
Parameters:
options({ kind, semantic?, ...kind-specific })callback((result, error)) - per the_promisifycontract.
Returns: void
createEntity() internal
javascript
createEntity(jsonValue: any, callback: any): voidParameters:
jsonValue(any)callback(any)
Returns: void
createValueAnimation() internal
javascript
createValueAnimation(options: any): ValueAnimationParameters:
options(any)
Returns: ValueAnimation
loadComputeKernel() internal
javascript
loadComputeKernel(options: { source?: string, assetId?: string, functionName: string }, callback: (result, error)): voidInternal bridge – JS authors use Kernel.fromSource({...}) / Kernel.fromAsset({...}). The shape on scene stays minimal: one callback-based entrypoint that the runtime _promisify wraps into a Promise.
Parameters:
options({ source?: string, assetId?: string, functionName: string })callback((result, error)) - per the_promisifycontract.
Returns: void
materialDataById() internal
javascript
materialDataById(id: string): anyInternal: fetch raw material data from the experience material library by id. The runtime wraps this into scene.getMaterial(id) returning a hydrated Material instance suitable for .clone() / property edits. Authors call scene.getMaterial(id), not this method directly.
Parameters:
id(string)
Returns: any
playAudioBuffer() internal
javascript
playAudioBuffer(base64: string, options: Array<any>, callback?: any): voidParameters:
base64(string)options(Array<any>)callback(any) (optional)
Returns: void
runAction() internal
javascript
runAction(proxyAction: Action, callback: any): voidParameters:
proxyAction(Action)callback(any)
Returns: void
subscribeToEvent() internal
javascript
subscribeToEvent(jsonValue: any, callback: any): stringParameters:
jsonValue(any)callback(any)
Returns: string
unsubscribeFromEvent() internal
javascript
unsubscribeFromEvent(eventId: string): voidParameters:
eventId(string)
Returns: void