Forum Widgets
Recent Discussions
VR Screen Navigation
Hi Team, I am struggling to perform screen navigation from a VR screen to another VR screen. I checked the samples but could not get any clue. Is it even supported or do we have to survive with loading different scenes in the launcher activity itself? Yes, I have added the activity in the manifest file and it works when I make that 2nd activity as launcher. However when I try to launch it from the 1st activity it simply crashes. This is the error I get ... FATAL EXCEPTION: main Process: com.mixed.reality.factory, PID: 26659 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mixed.reality.factory/com.mixed.reality.factory.LoaderQuestActivity}: java.lang.Exception: Native Assert. FILE=icsHE/GraphicsHorizon.cpp:161 MSG= at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3807) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3947) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2468) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:218) at android.os.Looper.loop(Looper.java:310) at android.app.ActivityThread.main(ActivityThread.java:8250) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978) Caused by: java.lang.Exception: Native Assert. FILE=icsHE/GraphicsHorizon.cpp:161 MSG= at com.meta.spatial.core.SpatialInterface.nativeInit(Native Method) at com.meta.spatial.core.SpatialInterface.init(SpatialInterface.kt:134) at com.meta.spatial.runtime.VrActivity.onCreate(VrActivity.kt:223) at com.meta.spatial.toolkit.AppSystemActivity.onCreate(AppSystemActivity.kt:56) at com.mixed.reality.factory.LoaderQuestActivity.onCreate(LoaderQuestActivity.kt:59) at android.app.Activity.performCreate(Activity.java:8636) at android.app.Activity.performCreate(Activity.java:8614) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3789) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3947) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2468) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:218) at android.os.Looper.loop(Looper.java:310) at android.app.ActivityThread.main(ActivityThread.java:8250) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978) Any help would be highly appreciated.egrabhishek3 months agoHonored Guest38Views0likes0CommentsIs there a way to place a object in the hand instead of the contorllers
Hey, I am trying to make a shooting range application, and I wish for the weapon in the game to be in the place of the controller. I don't have a beefy computer and meet the bare minimum, and this was the only way I code for Quest 3 at the moment, which is through the Meta Spatial SDK. I see in the spatial Editor there is an AvatarBody Component that allows you to attach things to it, but I am reading that it allows you to use it in the sense of making your own Playable Avatar and using that to attach things to your avatar. there are no samples out there yet anyone figured out how to replace the controller model with another object yetsimplecast5 months agoMember102Views0likes0CommentsCustom Item Tracking using Spatial SDK
We are trying to implement a custom tracking system along with Quest's tracking. We want the headset to be able to detect custom gloves that we put in our hands, is it possible to train the current ml models or the Spatial sdk currently only uses the pretrained model?manrock77885 months agoHonored Guest89Views0likes0CommentsBatting cage tutorial issues with spawning ball above player location
I am trying to add to the batting tutorial and I am having issues spawning the ball above the players head. I have implemented a couple different ways but they dont work. They will compile but the collision detection doesnt work. I have recieved errors such as failed to call method 'start' as well as having the code work with error detection but break once the player moves. This is my current code: import * as hz from 'horizon/core'; type State = { originalPosition: hz.Vec3 } class BallScript extends hz.Component<typeof BallScript> { static propsDefinition = {}; originalPosition!: hz.Vec3; start() { // Listen for ball collisions with the ground. this.connectCodeBlockEvent(this.entity, hz.CodeBlockEvents.OnEntityCollision, (collidedWith: hz.Entity, collisionAt: hz.Vec3, normal: hz.Vec3, relativeVelocity: hz.Vec3, localColliderName: string, otherColliderName: string) => { // Move the ball back to its starting position above the local player's head. const localPlayer = this.world.getLocalPlayer(); if (localPlayer) { const playerPosition = localPlayer.position.get(); this.entity.position.set(playerPosition.add(new hz.Vec3(0, 2, 0))); // adjust the height as needed } // Reset the ball's velocity. this.entity.as(hz.PhysicalEntity).zeroVelocity(); } ); // Update the original position if the local player is already in the world. const localPlayer = this.world.getLocalPlayer(); if (localPlayer) { this.updateOriginalPosition(localPlayer); } // Listen for the player entering the world and update the original position. this.connectCodeBlockEvent(this.entity, hz.CodeBlockEvents.OnPlayerEnterWorld, (player: hz.Player) => { if (player === this.world.getLocalPlayer()) { this.updateOriginalPosition(player); } }); } // Update the original position of the ball to be above the player's head. private updateOriginalPosition(player: hz.Player) { const playerPosition = player.position.get(); this.originalPosition = playerPosition.add(new hz.Vec3(0, 2, 0)); // adjust the height as needed } // Get the original position of the ball so that it respawns in the same place. override receiveOwnership(state: State, fromPlayer: hz.Player, toPlayer: hz.Player): void { this.originalPosition = state.originalPosition.clone(); // clone the Vec3 to avoid modifying the original state if (toPlayer === this.world.getLocalPlayer()) { this.updateOriginalPosition(toPlayer); } } // Pass the ball's original position to the new owner. override transferOwnership(fromPlayer: hz.Player, toPlayer: hz.Player): State { return { originalPosition: this.originalPosition.clone() }; // clone the Vec3 to avoid modifying the original state } } hz.Component.register(BallScript);TerianDiLun6 months agoMember214Views0likes0CommentsPossible bug in Entity trySetMapvalue generic type argument
The trySetMapValue is using the generic key type for the value: public final inline fun <reified T, reified V> tryGetMapValue(attribute: kotlin.Int, key: T): V? { /* compiled code */ } public final inline fun <reified T, reified V> trySetMapValue(attribute: kotlin.Int, key: T, value: T): kotlin.Boolean { /* compiled code */ } Is this the intended behavior? Also, what's the purpose of the Entity map? I'm trying to use it to save the internal state of the entity, but I don't know if this is ideal.hsartori6 months agoHonored Guest174Views0likes0CommentsHow to detect user interaction and dynamically set a video panel resolution?
Hi, I'm currently working on a project using the Meta Spatial SDK, and I have a couple of questions that I need help with. 1) Detecting User Interaction to Show a Panel: In my project, I have a 360° video player panel, built with Jetpack Compose, that disappears after 7 seconds of inactivity. I want it to become visible again whenever there is any user interaction (such as any left or right controller input, pinching with hand tracking). Additionally, I’d like the panel to follow the user’s view (camera orientation) during video playback, so that it always stays in the user's line of sight while watching the 360° video. Here’s my current implementation: fun ExoPlayerControlPanel(viewModel: ExoPlayerViewModel) { var isPanelVisible = remember { mutableStateOf(true) } var lastInteractionTime = remember { mutableLongStateOf(System.currentTimeMillis()) } var volume = remember { mutableFloatStateOf(1.0f) } // Hide the panel after 7 seconds of inactivity LaunchedEffect(isPanelVisible.value) { while (isPanelVisible.value) { delay(7000) val elapsedTime = System.currentTimeMillis() - lastInteractionTime.longValue if (elapsedTime >= 7000) { Log.d(TAG, "Panel hidden due to inactivity") isPanelVisible.value = false SpatialActivityManager.executeOnVrActivity<ImmersiveActivity> { activity -> activity.videoPanel!!.setComponent(Visible(false)) } } if (some interaction) { // <-- How to properly detect interaction here? showPanel } } } // Content to show Box( modifier = Modifier .fillMaxSize() .background(Color.Black.copy(alpha = 0.8f)) ) { if (isPanelVisible.value) { ... } } } What I've tried so far: Adding an event listener to the Sky Video Panel, but it doesn't seem clickable. The event listener works fine on other objects in the scene, but not when the video is playing. This is likely because all the other objects in the scene are disabled during the video playback, leaving only the video visible. skyVideoPanel?.registerEventListener<ButtonDownEventArgs>(ButtonDownEventArgs.EVENT_NAME) { entity: Entity, args: ButtonDownEventArgs -> if (args.button == ControllerButton.RightSqueeze) { val rightController = Query.where { has(AvatarAttachment.id) } .eval() .filter { it.getComponent<AvatarAttachment>().type == "right_controller" } .first() videoPanel?.setComponent(Visible(true)) } } Instantiating the controllers inside the onCreate method of the scene to detect clicks, but I wasn't able to get it working. 2) Dynamically Setting the Video Panel Resolution: I also need to dynamically set the video resolution for the panel, depending on the video resolution being played. For example, I want the panel size to adjust based on whether the video is in 4K, 8K, or other resolutions. Here’s the code I have for registering the panel: private fun skyVideoPanelRegistration(): PanelRegistration { return PanelRegistration(R.integer.sky_video_id) { layoutResourceId = R.layout.sky_video_layout config { // Dynamically change this size depending on the video resolution. layoutWidthInPx = 3840 layoutHeightInPx = 2160 pivotOffsetWidth = 0.0f pivotOffsetHeight = 0.0f layerConfig = LayerConfig() panelShapeType = PanelShapeType.EQUIRECT radiusForCylinderOrSphere = 300.0f mips = 1 } panel { setIsVisible(false) playerView = rootView?.findViewById<PlayerView>(R.id.player_view) playerView?.useController = false entity?.setComponent(Transform.build { rotateY(180f) }) } } } fun playVideo(videoUrl: String) { Log.d(TAG, "Video URL: $videoUrl") sceneState = SceneState.MOVIE playerView?.player = exoPlayer val uri = Uri.parse(videoUrl) val mediaItem = MediaItem.fromUri(uri) exoPlayer!!.addMediaItem(mediaItem) exoPlayer!!.prepare() exoPlayer!!.playWhenReady = true } Question: What is the best way to detect any user interaction (left or right controller input, pinching with hand tracking) to make the panel visible again? How can I make the ExoPlayer panel follow the user's view during playback? How can I dynamically adjust the video panel resolution based on the video being played (e.g., 4K, 8K) and change it dynamically during playback if the video quality changes? Thank you in advance for your help!PJBHL8 months agoHonored Guest329Views0likes0CommentsBody tracking with Spatial SDK
Spatial SDK has a TrackedBody component. That sugeests that there should be a way to access the body tracking info (e.g. the joints). The functionality itself works great in the native example I've tried. I haven't found any examples though with Spatial SDK and all my tries with TrackedBody were unsuccessful. I've tried something similar to AvatarBody, but to na avail.mgolinski9 months agoHonored Guest282Views0likes0CommentsWhy does terrain move with object I'm trying to move?
Hi all. Beginning worldbuilder here; weird thing happening. I'm trying to pick up and move objects while building my first world. Every time I do, the terrain underneath comes along with them! (I can place objects like a cube, sphere etc. but can't pick them back up without moving the terrain too.) Snapping is off, so wondering what I'm doing wrong?silversteam9 months agoMember220Views0likes0Comments
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device