Forum Widgets
Recent Discussions
Spatial SDK and Passthrough Camera Access
Can I get a passthrough camera stream open while running the Spatial SDK? I modified the Starter Template (https://github.com/meta-quest/Meta-Spatial-SDK-Templates/tree/main/StarterTemplate/app) just to open the camera but it seems to cause the camera to disconnected immediately. I added a startCamera method to run when one of the panels is selected (instead of running the video): private fun startCamera() { if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { Log.i("MainActivity", "Camera permission not granted") } if (checkSelfPermission("horizonos.permission.HEADSET_CAMERA") != PackageManager.PERMISSION_GRANTED) { Log.i("MainActivity", "horizonos.permission.HEADSET_CAMERA permission not granted") } val cameraManager: CameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager val cameraIds: Array = cameraManager.cameraIdList var cameraId: String = "" for (id in cameraIds) { Log.i("MainActivity", "Camera ID: $id") val cameraCharacteristics = cameraManager.getCameraCharacteristics(id) if(cameraCharacteristics.get(Key("com.meta.extra_metadata.camera_source", Int::class.java)) == 0) { cameraId = id continue } } cameraManager.openCamera(cameraId, cameraStateCallback, Handler(Looper.getMainLooper())) } All permissions are good but it just fails: 2025-09-12 14:36:20.269 11285-11285 MainActivity com...atial.samples.startertemplate I All permissions already granted 2025-09-12 14:36:20.271 11285-11285 MainActivity com...atial.samples.startertemplate I Camera ID: 1 2025-09-12 14:36:20.278 11285-11285 MainActivity com...atial.samples.startertemplate I Camera ID: 50 2025-09-12 14:36:20.279 11285-11285 MainActivity com...atial.samples.startertemplate I Camera ID: 51 2025-09-12 14:36:20.299 1402-1402 CameraAccessController system_server E Failed to injectCamera for cameraId:51 package:com.meta.spatial.samples.startertemplate (Ask Gemini) android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): injectCamera:3274: No camera device with ID "" currently available Am I missing something, can this work?Solvedmeteorik3 months agoHonored Guest84Views0likes1CommentKeep Rules in Proguard Files (Using R8 Minify)
I'm developing an Immersive App for Meta Quest using the Meta Spatial SDK in Android Studio with R8 minification enabled. When building a signed APK, I encounter the following error: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in D:\AndroidProject\[package-name]\app\build\outputs\mapping\questRelease\missing_rules.txt. Missing class horizonos.app.container.TaskContainer (referenced from: horizonos.app.container.TaskContainer com.meta.spatial.runtime.PanelDisplay.taskContainer and 4 other contexts) Missing class horizonos.app.container.TaskContainerManager$TaskContainerCallback (referenced from: horizonos.app.container.TaskContainer com.meta.spatial.runtime.PanelDisplay.tryGetTaskContainer(android.content.Context, android.content.Context) and 2 other contexts) Missing class horizonos.app.container.TaskContainerManager (referenced from: horizonos.app.container.TaskContainer com.meta.spatial.runtime.PanelDisplay.tryGetTaskContainer(android.content.Context, android.content.Context)) Missing class vros.os.VrosBuild (referenced from: horizonos.app.container.TaskContainer com.meta.spatial.runtime.PanelDisplay.tryGetTaskContainer(android.content.Context, android.content.Context)) The missing_rules.txt file suggests adding the following rules to proguard-rules.pro: # Please add these rules to your existing keep rules in order to suppress warnings. # This is generated automatically by the Android Gradle plugin. -dontwarn horizonos.app.container.TaskContainer -dontwarn horizonos.app.container.TaskContainerManager$TaskContainerCallback -dontwarn horizonos.app.container.TaskContainerManager -dontwarn vros.os.VrosBuild When I add these -dontwarn rules to proguard-rules.pro, the signed APK builds successfully. However, when I deploy and launch the APK on a Meta Quest device, the app gets stuck in a loading state and eventually shows a "Not Responding" error after some time. I’ve also tried the following keep rules in proguard-rules.pro, but they prevent the APK from building: -keep class horizonos.** { *; } -keep class vros.** { *; } -keep class com.meta.spatial.** { *; } My question: What specific keep rules should I use in proguard-rules.pro to ensure that the necessary classes are preserved, allowing the app to build successfully and load properly on Meta Quest without getting stuck in the loading state?SolvedlucyAlvin4 months agoHonored Guest71Views0likes2CommentsHow to set alphaMode on custom material?
I only see the alphaMode in the SceneMaterial constructor, but not in the SceneMaterial.custom function? Not is there a settable property for this? I want objects with some of my custom materials to use the TRANSLUCENT_POST option.Solvedwaynecochran5 months agoProtege143Views0likes1CommentIs there a simple way to increase the pointer distance ?
It seems the pointer max distance is limited. Is there a way to increase this value, in order to be able to select ui items from a panel that is very large or far away for example ? ThxSolvedShadowyLynx18665 months agoExplorer159Views0likes1CommentHow to change appearance(baseColorTexture) of a preload glb runtime?
Im a beginner in 3D development. I import a glb object into environment.env with predefined textures(baseColorTexture, normalTexture, occlusionTexture), and I try to change the appearance(runtime) when clicking buttons. Here are my code, but It didn't work to change the texture (baseColor or baseColorTexture). Is there anyone could help me? Thank you very much. private fun changeMaterial(node : SceneObject) { val material = node.mesh?.materials?.get(0) var mesh = node.mesh var meshMaterial = node.mesh?.getMaterial(0) as SceneMaterial var test_texture = SceneTexture(activity.getDrawable(R.drawable.test_texture)) //var texture_name = "baseColor" //--> exception: baseColor not found var texture_name = "occlusion" //--> worked and texture is changed meshMaterial.setTexture(texture_name, test_texture) }SolvedBigMac17717 months agoHonored Guest267Views0likes1CommentHow to get the relative position of the left and right eye to the head sensor?
On the host we can query the position and orientation of the head as follows: fun getHeadPose(): Pose { val head = Query.where { has(AvatarAttachment.id) } .eval() .filter { it.isLocal() && it.getComponent<AvatarAttachment>().type == "head" } .first() return head.getComponent<Transform>().transform } In a material shader we can get the position of the left and right eye via the uniforms: g_ViewUniform.eyeCenter0 and g_ViewUniform.eyeCenter1 But is there either... * ....a way to get the position of the head in the shader (short of passing it as a uniform attribute every frame)? or * ... a way to get the position (or relative position) of the left and right eye on the host?Solvedwaynecochran8 months agoProtege617Views0likes1CommentHow to update contents of SceneTexture in SpatialSDK?
I'm working with a SceneTexture instance passed to a shader for rendering in this fashion: val videoTexture = SceneTexture(Color.valueOf(0f, 0f, 1f, 1f)) videoMaterial = SceneMaterial.custom("myShader", arrayOf( SceneMaterialAttribute("videoTexture", SceneMaterialDataType.Texture2D) )).apply { setTexture("videoTexture", videoTexture) } Is there any way to update the videoTexture without creating a new SceneTexture instance? I've tried the following: frame?.copyPixelsToBuffer(copyBuffer!!) videoTexture.update(copyBuffer!!, frame!!.width, frame.height, 4) videoMaterial!!.setTexture("videoTexture", videoTexture) where frame is a Bitmap with a per pixel byte count of 4 (format ARGB_8888). It results in no visible changes to the texture, even if copyBuffer is empty. It's hard to tell if this is the correct usage or if this update function even does anything at all considering the the lack of information on the official documentation. I've also tried looking through the official samples, but found no mentions of this function.SolvedPointyLlama52739 months agoExplorer489Views1like1CommentIssue when forward to new activity
Hi at all! I'm trying to start another activity with a different panel. From starter template I take the button and prepare the intent. I want to re-use the original environment and register a new panel for the new activity, but if I try I have this: java.lang.Exception: Native Assert. FILE=Utils/AndroidUtils.cpp:102 MSG=Global asset manager can only be set once at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3724) This is my target activity: import com.meta.spatial.castinputforward.CastInputForwardFeature import com.meta.spatial.core.SpatialFeature import com.meta.spatial.debugtools.HotReloadFeature import com.meta.spatial.runtime.LayerConfig import com.meta.spatial.toolkit.AppSystemActivity import com.meta.spatial.toolkit.PanelRegistration import com.meta.spatial.vr.VRFeature class TestActivity : AppSystemActivity() { override fun registerFeatures(): List<SpatialFeature> { val features = mutableListOf<SpatialFeature>(VRFeature(this), HotReloadFeature(this)) if (BuildConfig.DEBUG) { features.add(CastInputForwardFeature(this)) } return features } override fun registerPanels(): List<PanelRegistration> { return listOf( PanelRegistration(R.layout.ui_new_panel) { config { themeResourceId = R.style.PanelAppThemeTransparent includeGlass = false width = 2.0f height = 1.5f layerConfig = LayerConfig() enableTransparent = true } }) } } Thanks!SolvedLuisInThisUniverse9 months agoHonored Guest740Views0likes4Comments
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device