class Scene(val spatialInterface: SpatialInterface)
Scene
(
spatialInterface
)
|
Signature
constructor(spatialInterface: SpatialInterface) Parameters spatialInterface: SpatialInterfaceReturns Scene |
handle
: Long
[Get] |
Signature
val handle: Long |
spatialInterface
: SpatialInterface
[Get] |
Signature
val spatialInterface: SpatialInterface |
addObject
(
ro
)
|
Add a SceneObject to this Scene.
Signature
fun addObject(ro: SceneObject) Parameters |
createCylinderLayer
(
sceneSwapChain
, radius
, centralAngle
, aspectRatio
, pivotX
, pivotY
, stereoMode
, sceneObject
)
|
Create a Layer that is shaped like a cylinder.
Signature
fun createCylinderLayer(sceneSwapChain: SceneSwapchain, radius: Float, centralAngle: Float, aspectRatio: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject): Int Parameters radius: Float
The radius of the cylinder.
centralAngle: Float
The central angle of the cylinder.
aspectRatio: Float
The aspect ratio of the Layer.
pivotX: Float
The pivot point of the Layer in the x dimension.
pivotY: Float
The pivot point of the Layer in the y dimension.
Returns Int
The new cylinder layer.
|
createEquirectLayer
(
sceneSwapChain
, radius
, centralHorizontalAngle
, upperVerticalAngle
, lowerVerticalAngle
, pivotX
, pivotY
, stereoMode
, sceneObject
)
|
Create a Layer that maps equirectangular images onto a sphere.
Signature
fun createEquirectLayer(sceneSwapChain: SceneSwapchain, radius: Float, centralHorizontalAngle: Float, upperVerticalAngle: Float, lowerVerticalAngle: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject): Int Parameters radius: Float
The radius of the sphere.
centralHorizontalAngle: Float
The central angle of the sphere.
upperVerticalAngle: Float
The upper vertical angle of the sphere.
lowerVerticalAngle: Float
The lower vertical angle of the sphere.
pivotX: Float
The pivot point of the Layer in the y dimension.
pivotY: Float
The pivot point of the Layer in the x dimension.
Returns Int
the equirectangular layer.
|
createQuadLayer
(
sceneSwapChain
, dimW
, dimH
, pivotX
, pivotY
, stereoMode
, sceneObject
)
|
Create a Layer that is shaped like a quad.
Signature
fun createQuadLayer(sceneSwapChain: SceneSwapchain, dimW: Float, dimH: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject): Int Parameters dimW: Float
The width of the Layer.
dimH: Float
The height of the Layer.
pivotX: Float
The pivot point of the Layer in the x dimension.
pivotY: Float
The pivot point of the Layer in the y dimension.
Returns Int
The new quad layer.
|
destroyObject
(
ro
)
|
Remove and destroy a SceneObject from this Scene.
Signature
fun destroyObject(ro: SceneObject) Parameters |
discoverSpaces
(
fetchOptions
)
|
Find all the space.
Signature
fun discoverSpaces(fetchOptions: Anchor.FetchOptions): CompletableFuture<Array<Anchor>> Parameters fetchOptions: Anchor.FetchOptions
The options to use.
Returns CompletableFuture
A future containing an aray of anchors.
|
drawDebugLine
(
from
, to
, color
, displayCount
)
|
Draw a line in the Scene, often used for debugging.
Signature
fun drawDebugLine(from: Vector3, to: Vector3, color: Color, displayCount: Int) |
drawDebugLine
(
from
, to
, startColor
, endColor
, displayCount
)
|
Draw a line in the Scene, often used for debugging.
Signature
fun drawDebugLine(from: Vector3, to: Vector3, startColor: Color, endColor: Color, displayCount: Int) |
enableEnvironmentDepth
(
enabled
)
|
Experimental: Enable environment depth with automatic occlusion.
This is a convenience method for backward compatibility. For more control over depth behavior, use Scene.setEnvironmentDepthMode instead.
Signature
fun enableEnvironmentDepth(enabled: Boolean) Parameters enabled: Boolean
Whether the environment depth is enabled or not.
|
enableHolePunching
(
enabled
)
|
Tells the renderer to render poseable layers before rendering out the scene. This means the app will be responsible for hole-punching the layers.
See our Layers and UI Quality docs for more information.
Signature
fun enableHolePunching(enabled: Boolean) Parameters enabled: Boolean |
enableMrPlaneTracker
(
enabled
)
|
Enable the MR plane tracker.
Signature
fun enableMrPlaneTracker(enabled: Boolean) Parameters enabled: Boolean
Whether the plane tracker should be enabled or not.
|
enablePassthrough
(
enabled
)
|
Enable pass through of the real world into the scene.
Signature
fun enablePassthrough(enabled: Boolean) Parameters enabled: Boolean |
enableVirtualCamera
(
enable
)
|
Enable the virtual camera.
Signature
fun enableVirtualCamera(enable: Boolean) Parameters enable: Boolean
Whether to enable the virtual camera.
|
getAnchorBoundary2D
(
anchorHandle
)
|
Get the 2D boundary of an anchor.
Signature
fun getAnchorBoundary2D(anchorHandle: Long): Array<Vector2> Parameters anchorHandle: Long
The handle to an anchor.
Returns Array
An array of Vector2 objects representing the boundary.
|
getAnchorBoundingBox2D
(
anchorHandle
)
|
Get the 2D bounding box of an anchor.
Signature
fun getAnchorBoundingBox2D(anchorHandle: Long): Bound2D? Parameters anchorHandle: Long
The handle to an anchor.
|
getAnchorBoundingBox3D
(
anchorHandle
)
|
Get the 3D bounding box for an anchor.
Signature
fun getAnchorBoundingBox3D(anchorHandle: Long): Bound3D? Parameters anchorHandle: Long
The handle to an anchor.
|
getAnchorPose
(
anchorHandle
)
|
Get the pose of an anchor.
Signature
fun getAnchorPose(anchorHandle: Long): Pose Parameters anchorHandle: Long
The handle to an anchor.
|
getAnchorPose
(
index
)
|
Get the pose of an anchor.
Signature
fun getAnchorPose(index: Int): Pose Parameters index: IntReturns Pose |
getAnchorSemanticLabels
(
anchorHandle
)
|
Get the semantic lables for an anchor.
Signature
fun getAnchorSemanticLabels(anchorHandle: Long): List<String> Parameters anchorHandle: Long
The handle to an anchor.
Returns List
A list of strings.
|
getAnchorSemanticLabels
(
index
)
|
Get the semantic labels for an anchor by index.
Signature
fun getAnchorSemanticLabels(index: Int): String Parameters index: IntReturns String
The semantic labels.
|
getBodyJointCount
()
|
Convenience accessor for the number of body joints supported by the device.
This value may be 0 if body tracking is unavailable on the device.
Signature
fun getBodyJointCount(): Int Returns Int
The number of body joints, or 0 if unsupported/unavailable.
|
getConfirmedFrameRate
()
|
Signature
fun getConfirmedFrameRate(): Float Returns Float |
getControllerPoseAtTime
(
isLeftHandle
, time
)
|
Get the pose of the controller at a given time.
Signature
fun getControllerPoseAtTime(isLeftHandle: Boolean, time: Long): ControllerPose Parameters isLeftHandle: Boolean
Whether this is the left controller or not.
time: Long
The nanoseconds time from boot to get the pose at. SystemClock.elapsedTimeNanos()
|
getEyeOffsets
()
|
Get the current eye offsets for the stereo camera system.
Eye offsets describe the relative position of each eye from the center of the head. Positive X values offset to the right, Positive Y values offsets up, and positive Z offsets forward. Rotation of eyes is the same as head position.
Signature
fun getEyeOffsets(): Pair<Vector3, Vector3> Returns Pair<Vector3, Vector3>
A pair containing two Vector3 objects: Pair(leftEyeOffset, rightEyeOffset).
|
getNumberOfObjects
()
|
Get the number of SceneObjects in the scene.
Signature
fun getNumberOfObjects(): Int Returns Int
The number of SceneObjects in the scene.
|
getOpenXrGetInstanceProcAddrHandle
()
|
Returns the xrGetInstanceProcAddr function pointer as a Long (void* cast to Long).
This is an experimental API that exposes the OpenXR function loader to enable developers to load OpenXR extension functions directly for advanced use cases not yet supported by the SDK.
Example usage in JNI native code:
extern "C" JNIEXPORT void JNICALL
Java_com_example_MyFeature_loadExtension(
JNIEnv* env, jobject thiz,
jlong instanceHandle, jlong procAddrHandle) {
XrInstance instance = (XrInstance)instanceHandle;
auto xrGetInstanceProcAddr = (PFN_xrGetInstanceProcAddr)procAddrHandle;
// Load an extension function
PFN_xrSomeExtensionFunction myFunc;
xrGetInstanceProcAddr(instance, "xrSomeExtensionFunction",
(PFN_xrVoidFunction*)&myFunc);
// Use myFunc...
}
Signature
fun getOpenXrGetInstanceProcAddrHandle(): Long Returns Long
The PFN_xrGetInstanceProcAddr function pointer as a Long, or 0 if not available
|
getOpenXrInstanceHandle
()
|
Returns the OpenXR instance handle as a Long (void* cast to Long).
This is an experimental API that exposes the underlying XrInstance handle to enable developers to call OpenXR functions directly for advanced use cases not yet supported by the SDK.
Example usage in JNI native code:
extern "C" JNIEXPORT void JNICALL
Java_com_example_MyFeature_doOpenXrStuff(JNIEnv* env, jobject thiz, jlong instanceHandle) {
XrInstance instance = (XrInstance)instanceHandle;
// Use instance to call OpenXR functions...
}
Signature
fun getOpenXrInstanceHandle(): Long Returns Long
The XrInstance handle as a Long, or 0 if not available
|
getOpenXrSessionHandle
()
|
Returns the OpenXR session handle as a Long (void* cast to Long).
This is an experimental API that exposes the underlying XrSession handle to enable developers to call OpenXR functions directly for advanced use cases not yet supported by the SDK.
Example usage in JNI native code:
extern "C" JNIEXPORT void JNICALL
Java_com_example_MyFeature_doOpenXrStuff(JNIEnv* env, jobject thiz, jlong sessionHandle) {
XrSession session = (XrSession)sessionHandle;
// Use session to call OpenXR functions...
}
Signature
fun getOpenXrSessionHandle(): Long Returns Long
The XrSession handle as a Long, or 0 if not available
|
getRuntimeName
()
|
Returns the name of the graphics runtime being used.
This can be used to customize runtime behavior based on which graphics backend is active (e.g., controller transform handling).
Example usage:
val runtime = scene.getRuntimeName()
if (runtime == GraphicsRuntimeName.MHE) {
// Apply MHE-specific behavior
}
Signature
fun getRuntimeName(): GraphicsRuntimeName Returns GraphicsRuntimeName
The graphics runtime name enum value.
|
getSessionStartPose
()
|
Returns the pose that was set at the beginning of the session. This is useful for setting the starting position of entities so that they are placed relative to the user.
Signature
fun getSessionStartPose(): Pose |
getSkeletonChangedCount
()
|
Returns a monotonically increasing counter that reflects skeleton topology updates.
Signature
fun getSkeletonChangedCount(): Int Returns Int |
getSpaceContainer
(
anchorHandle
)
|
Get the space container from an anchor.
Signature
fun getSpaceContainer(anchorHandle: Long): Array<UUID> Parameters anchorHandle: Long
The handle to an anchor.
Returns Array
An array of UUIDs.
|
getSpaceRoomLayout
(
anchorHandle
)
|
Get the RoomLayout from an anchor handle.
Signature
fun getSpaceRoomLayout(anchorHandle: Long): Anchor.RoomLayout Parameters anchorHandle: Long
The handle to an anchor.
Returns Anchor.RoomLayout
the roomlayout associated with the anchor handle.
|
getSpaceTriangleMesh
(
anchorHandle
)
|
Get the space triangle mesh associated with an anchor handle.
Signature
fun getSpaceTriangleMesh(anchorHandle: Long): Anchor.SpaceTriangleMesh Parameters anchorHandle: Long
The anchor handle.
Returns Anchor.SpaceTriangleMesh
The space triangle mesh.
|
getViewerPose
()
|
Get the viewer's pose in the Scene.
Signature
fun getViewerPose(): Pose |
getViewOrigin
()
|
Returns the last position that viewer's orgin was set to.
Signature
fun getViewOrigin(): Vector3 |
getViewSceneRotation
()
|
Get the last rotation of the viewer, with X+ being 0 degrees.
Signature
fun getViewSceneRotation(): Float Returns Float
The last rotation of the viewer in degrees.
|
hasObject
(
ro
)
|
Check if a SceneObject is part of this Scene.
Signature
fun hasObject(ro: SceneObject): Boolean Parameters Returns Boolean
True if the SceneObject is part of this Scene.
|
isSystemPassthroughEnabled
()
|
Is the passthrough system enabled. Returns true if the app is launched in passthrough mode and false if in immersive mode. This value is set at the app launch and will not change during the app's lifetime.
Signature
fun isSystemPassthroughEnabled(): Boolean Returns Boolean
Whether or not the passthrough system is enabled or not.
|
lineSegmentIntersect
(
from
, to
)
|
Test if a line segment intersects with anything in the scene.
Signature
fun lineSegmentIntersect(from: Vector3, to: Vector3): HitInfo? Parameters |
loadRenderModelMesh
(
path
)
|
Load a render model mesh given a path to a device. This uses the XR_FB_render_model OpenXR extension.
Signature
fun loadRenderModelMesh(path: String): SceneMesh? Parameters path: String
The to a device or controller. For example: "/model_fb/controller/left".
|
onClick
(
hitInfo
, sourceOfInput
)
| |
onClickDown
(
hitInfo
, sourceOfInput
)
| |
onHoverStart
(
sceneObjectHandle
, sourceOfInput
)
|
Handler for when a pointer start to hover over a SceneObject.
Signature
fun onHoverStart(sceneObjectHandle: Long, sourceOfInput: Entity) Parameters sceneObjectHandle: Long
The handle to SceneObject being hovered.
|
onHoverStop
(
sceneObjectHandle
, sourceOfInput
)
|
Handler for when a pointer stops hovering over a SceneObject.
Signature
fun onHoverStop(sceneObjectHandle: Long, sourceOfInput: Entity) Parameters sceneObjectHandle: Long
The handle to SceneObject being hovered.
|
onInput
(
hitInfo
, sourceOfInput
, changedIn
, buttonState
)
|
Handler for when we receive input that does intersect with SceneObjects.
Signature
fun onInput(hitInfo: HitInfo, sourceOfInput: Entity, changedIn: Int, buttonState: Int): Boolean Parameters Returns Boolean |
onNoIntersectionInput
(
sourceOfInput
, changedIn
, buttonState
)
|
Handler for when we receive input that does not intersect with any SceneObjects.
Signature
fun onNoIntersectionInput(sourceOfInput: Entity, changedIn: Int, buttonState: Int) Parameters changedIn: Int
The bit mask of buttons that were changed.
buttonState: Int
The bit mask of button state.
|
playBackgroundSound
(
soundAsset
, volume
, looping
)
|
Plays a sound which attached to the user pose, there is ony one background sound. The sound equivalent to an environment box
Signature
fun playBackgroundSound(soundAsset: SceneAudioAsset, volume: Float, looping: Boolean) Parameters volume: Float
The volume level of the sound.
looping: Boolean
Whether to loop playing this sound.
|
playSound
(
soundAsset
, position
, volume
)
|
Plays a sound within the 3d environment. The sound spatialization will update depending on head movement.
Signature
fun playSound(soundAsset: SceneAudioAsset, position: Vector3, volume: Float = 1.0f) Parameters volume: Float
The volume level of the sound.
|
playSound
(
soundfile
, entity
, volume
)
|
Plays a sound within the 3d environment. The sound spatialization will update depending on head movement
Signature
fun playSound(soundfile: SceneAudioAsset, entity: Entity, volume: Float = 1.0f) Parameters volume: Float
The volume level of the sound.
|
playSound
(
soundAsset
, volume
)
|
Plays a sound which is attached to the user pose
Signature
fun playSound(soundAsset: SceneAudioAsset, volume: Float = 1.0f) Parameters volume: Float
The volume level of the sound.
|
processQueries
(
dataModel
)
|
Process queries on a data model.
Signature
fun processQueries(dataModel: DataModel): Boolean Parameters dataModel: DataModelReturns Boolean
Whether or not queries were successfully processed.
|
rayArcIntersect
(
from
, forward
, gravity
, steps
, color
)
|
Draws and intersects a ray arc in the scene.
Signature
fun rayArcIntersect(from: Vector3, forward: Vector3, gravity: Vector3, steps: Int, color: Color)): HitInfo? Parameters Returns HitInfo? |
releaseBodyTrackingBuffers
()
|
Releases the buffers allocated for body tracking.
Call this when you no longer need body tracking data to free native memory. It's safe to call multiple times. subsequent calls will be no-ops.
Signature
fun releaseBodyTrackingBuffers() |
reloadShaders
(
baseDir
, vertexShaders
, fragmentShaders
)
|
Hot-reloads the given shaders at runtime. This functionality may be disabled.
Signature
fun reloadShaders(baseDir: String, vertexShaders: List<String>, fragmentShaders: List<String>) Parameters baseDir: String
The base directory to load the shaders from. This is usually the external storage.
vertexShaders: List
The list of vertex shaders to load (relative to both the baseDir and the assets directory).
fragmentShaders: List
The list of fragment shaders to load (relative to both the baseDir and the assets directory).
|
removeLayer
(
id
)
|
Remove a Layer form the Scene.
Signature
fun removeLayer(id: Int) Parameters id: Int
The id of the Layer.
|
removeObject
(
ro
)
|
Remove a SceneObject from this Scene without destroying it. This allows the SceneObject to be garbage collected and have its finalize() method called for cleanup.
Signature
fun removeObject(ro: SceneObject) Parameters |
requestSceneCapture
()
|
Request scene capture.
Signature
fun requestSceneCapture(): CompletableFuture<Unit> Returns CompletableFuture |
resetSessionStartPose
()
|
This function resets the session start pose to the current pose. This can be used to reset the session start pose when the user moves around.
Signature
fun resetSessionStartPose() |
resolveInput
()
|
Resolves all pending asynchronous input dispatches for SceneObjects that received input this frame. Calls SceneObject.resolveInput on each tracked SceneObject to block until their pending input injection has completed.
This provides a sync point ensuring all input dispatches are complete before the Choreographer's doFrame finishes.
Signature
fun resolveInput() |
setAudioEnabled
(
enabled
)
|
Enables or disables the audio player. When disabled, audio will not play regardless of focus state. This is independent of focus control and allows developers to completely disable audio even when the app has focus.
Actual audio playback = enabled AND focused
Signature
fun setAudioEnabled(enabled: Boolean) Parameters enabled: Boolean
Whether to enable or disable the audio player.
|
setBackfillColor
(
color
)
|
Set the background color of the Scene.
Signature
fun setBackfillColor(color: Color4) Parameters |
setBodyTrackingFidelity
(
fidelity
)
|
Sets the desired body tracking fidelity. The extension XR_META_body_tracking_fidelity is required to use this function.
Signature
fun setBodyTrackingFidelity(fidelity: BodyTrackingFidelity) Parameters |
setBodyTrackingJointSet
(
jointSet
)
|
Selects which body joint topology the body tracking system should provide. It's important to call this before invoking updateBodyTrackingBuffersAtTime for the first time.
Signature
fun setBodyTrackingJointSet(jointSet: JointSet) Parameters |
setColorSpace
(
colorSpace
)
|
Sets the color space used by the compositor for rendering.
This experimental API allows you to configure the color space for the entire scene, affecting how colors are displayed on the device. Different color spaces have different color gamuts (ranges of representable colors).
Example usage:
// Set to P3 for wider color gamut (ideal for images and video) scene.setColorSpace(ColorSpace.P3) // Set to Quest native color space scene.setColorSpace(ColorSpace.QUEST) // Set to Rec. 709 (standard HD video) scene.setColorSpace(ColorSpace.REC709)
Note: The actual color space support may vary depending on the device capabilities.
Signature
fun setColorSpace(colorSpace: Scene.ColorSpace) Parameters colorSpace: Scene.ColorSpace
The color space to use for rendering. See Scene.ColorSpace for available options.
|
setDepthParams
(
minDepth
, maxDepth
)
|
Set the depth parameters on the Scene.
Signature
fun setDepthParams(minDepth: Float, maxDepth: Float) Parameters minDepth: Float
The minimum depth of the Scene.
maxDepth: Float
The maximum depth of the Scene.
|
setEnvironmentDepthMode
(
mode
)
|
Sets the environment depth mode.
Controls whether and how environment depth sensing is used. Different modes provide different levels of integration between depth data and rendering:
The depth texture is automatically bound globally in shaders when depth sensing is enabled (OCCLUSION or TEXTURE_ONLY modes). You can access it in custom fragment shaders to create depth-aware effects.
Example:
// Enable depth with automatic occlusion (default behavior) scene.setEnvironmentDepthMode(EnvironmentDepthMode.OCCLUSION) // Enable depth texture only for custom shader effects scene.setEnvironmentDepthMode(EnvironmentDepthMode.TEXTURE_ONLY) // Disable depth sensing scene.setEnvironmentDepthMode(EnvironmentDepthMode.OFF)
Signature
fun setEnvironmentDepthMode(mode: EnvironmentDepthMode) Parameters |
setGlobalTransformScale
(
scale
)
|
Sets the global scale factor applied to all transforms in the transform system. This scale is applied globally to all entities during transform calculations.
Signature
fun setGlobalTransformScale(scale: Vector3) Parameters |
setGlobalTransformScale
(
scaleX
, scaleY
, scaleZ
)
|
Sets the global scale factor applied to all transforms in the transform system. This scale is applied globally to all entities during transform calculations.
Signature
fun setGlobalTransformScale(scaleX: Float, scaleY: Float, scaleZ: Float) Parameters scaleX: Float
The global scale factor for the X axis
scaleY: Float
The global scale factor for the Y axis
scaleZ: Float
The global scale factor for the Z axis
|
setLayerAlphaBlend
(
id
, srcFactorColor
, dstFactorColor
, srcFactorAlpha
, dstFactorAlpha
)
|
Set the alpha blend factors on a Layer. The integers correspond to the different layer alpha blend factors.
Signature
fun setLayerAlphaBlend(id: Int, srcFactorColor: Int, dstFactorColor: Int, srcFactorAlpha: Int, dstFactorAlpha: Int) Parameters id: IntsrcFactorColor: Int
The blend factor on the source color.
dstFactorColor: Int
The blend factor on the destination color.
srcFactorAlpha: Int
The blend factor on the source alpha.
dstFactorAlpha: Int
The blend factor on the destination alpha.
|
setLayerClip
(
id
, minLeftU
, minLeftV
, maxLeftU
, maxLeftV
, minRightU
, minRightV
, maxRightU
, maxRightV
)
|
Set clip bounds on a Layer in UV space.
Signature
fun setLayerClip(id: Int, minLeftU: Float, minLeftV: Float, maxLeftU: Float, maxLeftV: Float, minRightU: Float = minLeftU, minRightV: Float = minLeftV, maxRightU: Float = maxLeftU, maxRightV: Float = maxLeftV) Parameters id: Int
The Layer's id.
minLeftU: Float
The minimum left U value of the bounds.
minLeftV: Float
The minimum left V value of the bounds.
maxLeftU: Float
The maximum left U value of the bounds.
maxLeftV: Float
The maximum left V value of the bounds.
minRightU: FloatminRightV: FloatmaxRightU: FloatmaxRightV: Float |
setLayerColorScaleBias
(
id
, scaleR
, scaleG
, scaleB
, scaleA
, biasR
, biasG
, biasB
, biasA
)
|
Set the scale and bias on the color of a Layer.
Signature
fun setLayerColorScaleBias(id: Int, scaleR: Float, scaleG: Float, scaleB: Float, scaleA: Float, biasR: Float, biasG: Float, biasB: Float, biasA: Float) Parameters id: Int
The id of the Layer.
scaleR: Float
The scaling in the red dimension.
scaleG: Float
The scaling in the green dimension.
scaleB: Float
The scaling in the blue dimension.
scaleA: Float
The scaling in the alpha dimension.
biasR: Float
The bias in the red dimension.
biasG: Float
The bias in the green dimension.
biasB: Float
The bias in the blue dimension.
biasA: Float
The bias in the alpha dimension.
|
setLayerFilters
(
id
, filters
)
|
Applies the specified layer filters
Signature
fun setLayerFilters(id: Int, filters: Int) Parameters id: Int
The id of the Layer.
filters: Int
the composited filters to apply to the Layer
|
setLayerScale
(
id
, x
, y
, z
)
|
Set the scale of a Layer in the Scene.
Signature
fun setLayerScale(id: Int, x: Float, y: Float, z: Float) Parameters id: Int
The id of the Layer.
x: Float
The scaling in the x dimension.
y: Float
The scaling in the y dimension.
z: Float
The scaling in the z dimension.
|
setLayerSecure
(
id
, secureLayer
)
|
When set to true ensures the layer can not be copied or captured by other apps.
Signature
fun setLayerSecure(id: Int, secureLayer: Boolean) Parameters id: Int
The id of the Layer.
secureLayer: Boolean
Whether to enable secure layers.
|
setLayerZIndex
(
id
, zIndex
)
|
Set a Layer's Z index in depth ordering (default 0). If layers have the same z index, we will try to sort by distance to viewer.
Signature
fun setLayerZIndex(id: Int, zIndex: Int) Parameters id: Int
The Layer's id.
zIndex: Int
The z index in depth ordering.
|
setLightingEnvironment
(
ambientColor
, sunColor
, sunDirection
, environmentIntensity
)
|
Set the lighting environment for this Scene.
Signature
fun setLightingEnvironment(ambientColor: Vector3, sunColor: Vector3, sunDirection: Vector3, environmentIntensity: Float = 1.0f) |
setPassthroughLUT
(
lut
)
|
Sets a custom lookup table for color grading passthrough rendering. Passing null will remove any existing LUT, resetting passthrough to default colors.
Signature
fun setPassthroughLUT(lut: Lut?) Parameters lut: Lut? |
setPreferredDisplayRate
(
rate
)
|
Set the preferred display rate.
Signature
fun setPreferredDisplayRate(rate: Float): Boolean Parameters rate: Float
The display rate.
Returns Boolean
True if the display rate was set successfully. False otherwise.
|
setReferenceSpace
(
space
)
|
Sets the current OpenXR reference space. This may be wanted if you are working on a Mixed Reality vs purely Virtual Reality app.
For more details, see the OpenXR documentation.
Signature
fun setReferenceSpace(space: ReferenceSpace) Parameters |
setSecureLayers
(
secureLayers
)
|
When set to true ensures the layers can not be copied or captured by other apps.
Signature
fun setSecureLayers(secureLayers: Boolean) Parameters secureLayers: Boolean
Whether to enable secure layers.
|
setSkipRender
(
skipRender
)
|
UNSTABLE API. When set to true skips the rendering of the scene
Signature
fun setSkipRender(skipRender: Boolean) Parameters skipRender: Boolean |
setSpaceComponentStatus
(
anchorHandle
, type
, enable
, timeoutNs
)
|
Set the component status of a space.
Signature
fun setSpaceComponentStatus(anchorHandle: Long, type: Anchor.SpaceComponentType, enable: Boolean, timeoutNs: Long = 0): CompletableFuture<Void> Parameters anchorHandle: Long
The anchor handle
type: Anchor.SpaceComponentType
The type of the space.
enable: Boolean
Whether this is enabled.
timeoutNs: Long
When to timeout this space.
Returns CompletableFuture
A completable future of void.
|
setViewOrigin
(
x
, y
, z
)
|
Moves the viewer to the specified location.
Signature
fun setViewOrigin(x: Float, y: Float, z: Float) Parameters x: Float
The x component of the viewer's position.
y: Float
The y component of the viewer's position.
z: Float
The z component of the viewer's position.
|
setViewOrigin
(
x
, y
, z
, degRotation
)
|
Moves the viewer to the specified location, facing the specified direction.
Signature
fun setViewOrigin(x: Float, y: Float, z: Float, degRotation: Float) Parameters x: Float
The x component of the viewer's position.
y: Float
The y component of the viewer's position.
z: Float
The z component of the viewer's position.
degRotation: Float
The angular component of the viewer's orientation.
|
setVirtualCameraPose
(
pose
)
|
Set the virtual camera pose.
Signature
fun setVirtualCameraPose(pose: Pose) Parameters |
stopBackgroundSound
()
|
Stop playing the background sound.
Signature
fun stopBackgroundSound() |
tickMRScene
()
|
Process one tick of the Scene.
Signature
fun tickMRScene() |
updateBodyTrackingBuffersAtTime
(
jointPoses
, skeletonJoints
, time
)
|
Updates the body tracking buffers at the specified time (or next predicted display time).
This function retrieves the latest body tracking data (joint poses, skeleton, and tracking flags). It allocates buffers on the first call. The data is updated at the specified time or the next predicted display time if time is 0.
The function resizes the output list to match the number of joints supported by the system, preserving existing capacity where possible to avoid unnecessary allocations.
Manifest requirement: To use body tracking, add the following feature flag to your AndroidManifest.xml:
<uses-feature android:name="com.oculus.software.body_tracking" android:required="true" />
Example:
val jointPoses: MutableList<JointPose> = mutableListOf()
val skeletonJoints: MutableList<SkeletonJoint> = mutableListOf()
// Each frame call (use predicted display time)
if (scene.updateBodyTrackingBuffersAtTime(jointPoses, skeletonJoints)) {
for (jointPose in jointPoses) {
val isValid = (jointPose.flags and JointPose.ValidBits.toInt()) != 0
if (isValid) {
// Safe to use jointPose.pose
}
}
}
// When done
scene.releaseBodyTrackingBuffers()
Signature
fun updateBodyTrackingBuffersAtTime(jointPoses: MutableList<JointPose>, skeletonJoints: MutableList<SkeletonJoint>, time: Long = 0): Boolean Parameters jointPoses: MutableList
The destination list to receive joint poses; will be resized to joint count.
skeletonJoints: MutableList
The destination list to receive skeleton joints; will be resized to joint count.
time: Long
The time in nanoseconds at which to get the body tracking data. If 0 (default), uses the next predicted display time.
Returns Boolean
true if buffers were updated and data copied successfully; false otherwise.
|
updateCylinderLayer
(
id
, radius
, centralAngle
, aspectRatio
, pivotX
, pivotY
, stereoMode
)
|
Update a cylinder layer with new parameters.
Signature
fun updateCylinderLayer(id: Int, radius: Float, centralAngle: Float, aspectRatio: Float, pivotX: Float, pivotY: Float, stereoMode: Int) Parameters id: Int
The id of the Layer.
radius: Float
The radius of the cylinder.
centralAngle: Float
The central angle of the cylinder.
aspectRatio: Float
The aspect ratio of the Layer.
pivotX: Float
The pivot point of the Layer in the x dimension.
pivotY: Float
The pivot point of the Layer in the y dimension.
stereoMode: Int
The stereoMode of the Layer.
|
updateEquirectLayer
(
id
, radius
, centralHorizontalAngle
, upperVerticalAngle
, lowerVerticalAngle
, pivotX
, pivotY
, stereoMode
)
|
Update an equirectangular layer with new parameters.
Signature
fun updateEquirectLayer(id: Int, radius: Float, centralHorizontalAngle: Float, upperVerticalAngle: Float, lowerVerticalAngle: Float, pivotX: Float, pivotY: Float, stereoMode: Int) Parameters id: Intradius: Float
The radius of the sphere.
centralHorizontalAngle: Float
The central angle of the sphere.
upperVerticalAngle: Float
The upper vertical angle of the sphere.
lowerVerticalAngle: Float
The lower vertical angle of the sphere.
pivotX: Float
The pivot point of the Layer in the y dimension.
pivotY: Float
The pivot point of the Layer in the x dimension.
stereoMode: Int
The stereo mode of the Layer.
|
updateIBLEnvironment
(
envFilename
)
|
Update IBL environment with an image filename.
Signature
fun updateIBLEnvironment(envFilename: String) Parameters envFilename: String
The file path to use relative to your app's asset directory (.env extension)
|
updateQuadLayer
(
id
, dimW
, dimH
, pivotX
, pivotY
, stereoMode
)
|
Update a quad layer with new parameters.
Signature
fun updateQuadLayer(id: Int, dimW: Float, dimH: Float, pivotX: Float, pivotY: Float, stereoMode: Int) Parameters id: Int
The id of the Layer.
dimW: Float
The width of the Layer.
dimH: Float
The height of the Layer.
pivotX: Float
The pivot point of the Layer in the x dimension.
pivotY: Float
The pivot point of the Layer in the y dimension.
stereoMode: Int
The stereo mode of the Layer.
|
updateViewOrigin
(
deltaMove
, deltaRotation
)
|
Offset the viewer by a certain amount.
Signature
fun updateViewOrigin(deltaMove: Float, deltaRotation: Float) Parameters deltaMove: Float
Distance to move after the rotation
deltaRotation: Float
Amount to rotate around the Y axis in degrees.
|
enum ColorSpace : Enum<Scene.ColorSpace>
| Member | Description |
|---|---|
UNMANAGED |
Unmanaged color space - no color space conversion
|
REC2020 |
Rec. 2020 color space (HDR, wide gamut)
|
REC709 |
Rec. 709 color space (standard HD video)
|
RIFT_CV1 |
Rift CV1 color space
|
RIFT_S |
Rift S color space
|
QUEST |
Quest native color space
|
P3 |
Display P3 color space (wide gamut, better for images and video)
|
ADOBE_RGB |
Adobe RGB color space (wide gamut for photography)
|
value
: Int
[Get] |
The integer value used by the native OpenXR color space API
Signature
val value: Int |