ViroReact 3.4.0: Quest one-shot sounds, hand joints and recording, animation commands and AR depth maps
On Meta Quest, one-shot sounds play with no component mounted for each cue, onHandUpdate reports 25 named joints per hand, the passthrough camera records sessions and finds image markers, and exitVRScene() says what it did. ViroGameLoopUtils plays and stops animations without a React render on every platform, web included, and a reset returns a model to the pose it loaded in. AR sessions report why they could not start, the depth map can be read from JavaScript, and recordings gain low-light options and per-frame camera conditions for ReactVision Scan. Built on virocore 3.4.0, with no new requirements: React Native 0.88 and Expo SDK 58, as before. The web build works with @reactvision/viro-web-renderer 1.4.0 or later.
Meta Quest
ViroSound.playOneShotandViroSpatialSound.playOneShotplay a clip preloaded withViroSound.preloadSoundsonce, positioned or head-locked, with nothing mounted. The clip is decoded once and played from memory, with nothing on the main thread, so a game with many cues no longer lags. They play on iOS too; on visionOS and the web they resolvefalse. See ViroSound.onHandUpdateonViroXRSceneNavigatoris called: 25 named joints per hand in scene coordinates, with a radius each, up to 30 times a second. Nothing is computed while the prop is unset. See ViroXRSceneNavigator.- Session recording from the passthrough camera.
startRecording/stopRecordingon the navigator ref in mixed-reality scenes, with the same files as on a phone (no depth). See AR Session Recording. ViroARImageMarkerand Editor scenes' image-triggered content work on the headset, found in the passthrough camera's frames. Editor scenes on the free plan show their watermark in the headset view.exitVRScene()resolves with{ finished, panel }and takes{ panel: "direct" }to start the panel itself. It no longer does nothing in silence when it cannot find the headset view. See HorizonOS Setup Guide.- Controllers and activities. Controller ray requests always settle, and reject with
E_CONTROLLER_NOT_READYorE_CONTROLLER_TIMEOUTinstead of crashing or hanging. An olderViroControllergets events back when a newer one is torn down, and the menu button reaches the scene. A finishing headset view no longer answers the next one, andlaunchVRScenewaits for it. See ViroController.
Animation
ViroGameLoopUtils.playAnimationandstopAnimationplay, switch or stop a node's animation with no React render, on Android, iOS, visionOS and the web. Use them for a character that changes clip many times a second; theanimationprop is still the tool for an animation set once. See ViroGameLoop.stopAnimation({ mode: "reset" })returns a model to the pose it loaded in, morph targets and skeleton included.- Android: an
animationprop set again with equal values is left alone, instead of restarting or loggingUnable to play animation in state RUNNING.
AR
onARSessionErroronViroARSceneNavigatorsays why the session could not start: each ARCore startup failure on Android, an unsupported device or a denied camera on iOS. See ViroARSceneNavigator.getDepthMap()returns the current frame's depth in metres, with confidence, intrinsics and the camera pose, from LiDAR, the monocular estimator or ARCore's Depth API. See ViroARSceneNavigator.- Scans in low light.
startRecordingtakesmaxExposure,torch,codec,bitrateandstills;getCaptureConditions()tells a scan screen when to ask for more light or slower movement; every recording logs each frame's exposure, light and tracking; andstartScanCapture/stopScanCapturemake room and object captures for ReactVision Scan. See AR Session Recording. ViroObjectDetectortakes anhttps://model, downloaded once and cached on the device. See ViroObjectDetector.ViroPhysicsReplicatorshares physics bodies across devices over aViroReplicationClient: the device holding a body's claim simulates it, and the others follow its samples. See Co-Location.
Android
shaderModifiersandmaterialUniformsas node props, and drag, pinch and rotate on the scene root, as on iOS. See Shaders.ViroSound.preloadSoundsloads bundled sounds in a release build.
Web
ViroGameLoopUtils.setPosition,setRotationandsetScaleno longer throw, souseViroMapCameraworks.- One-time warnings for scenes that cannot work as written: an unwired
ViroARPlaneSelector, malformed transforms, an unknown physics body type, aViroTexttoo small to read, and a body that has fallen out of the world. See the Web Setup Guide.
Types and docs
- A three-argument
onCollisionhandler type-checks;bloomThresholdon a particle image is optional; a Compound physics shape needs noparams. physicsBody.velocityis documented as a constant velocity, reasserted every step. To launch or throw a body, usesetVelocityorapplyImpulse. See Physics.
Check when upgrading
- Quest one-shots, recording and image markers: one-shots need
ViroSound.preloadSoundsfirst. Recording and image markers on the headset need Quest 3 or 3S, Horizon OS v74 or later, andCAMERAandhorizonos.permission.HEADSET_CAMERAgranted at runtime. exitVRScene()returns a promise. Code that ignored the return value is unaffected.- Android: controller ray requests can now reject. Wrap early calls to
getControllerRayAsyncandgetControllerForwardAsyncintry/catch.
See Upgrading to 3.2.0 for the upgrade notes, and the GitHub releases for ViroReact 3.4.0 and viro-web-renderer 1.4.1.