Skip to content

Support for Meta Quest 3 #301

@sujathasperi2022

Description

@sujathasperi2022

Am developing an app for Meta Quest 3 using viro.

Below is the code I tried.

import {
  ViroARScene,
  ViroARSceneNavigator,
  ViroScene,
  ViroText,
  ViroTrackingReason,
  ViroTrackingStateConstants,
  ViroVRSceneNavigator,
} from "@reactvision/react-viro";
import React, { useState } from "react";
import { StyleSheet } from "react-native";

const HelloWorldSceneAR = () => {
  const [text, setText] = useState("Initializing AR...");

  function onInitialized(state: any, reason: ViroTrackingReason) {
    console.log("onInitialized", state, reason);
    if (state === ViroTrackingStateConstants.TRACKING_NORMAL) {
      setText("Hello World!");
    } else if (state === ViroTrackingStateConstants.TRACKING_UNAVAILABLE) {
      // Handle loss of tracking
    }
  }

  return (
    <ViroARScene onTrackingUpdated={onInitialized}>
      <ViroText
        text={text}
        scale={[0.5, 0.5, 0.5]}
        position={[0, 0, -1]}
        style={styles.helloWorldTextStyle}
      />
    </ViroARScene>
  );
};

export default () => {
  return (
    <ViroARSceneNavigator
      autofocus={true}
      initialScene={{
        scene: HelloWorldSceneAR,
      }}
      style={styles.f1}
    />
  );
};

var styles = StyleSheet.create({
  f1: { flex: 1 },
  helloWorldTextStyle: {
    fontFamily: "Arial",
    fontSize: 30,
    color: "#ffffff",
    textAlignVertical: "center",
    textAlign: "center",
  },
});

This is how it looks in android phone

imgpsh_fullsize_anim

When I run in MQ3

com oculus shellenv-20240709-221344

UPDATE 10 Jul 2024 12.31 PM

the on initialized function return as

onInitialized 1 1

state is 1 which means ViroTrackingStateConstants.TRACKING_UNAVAILABLE
reaon is 1 which means ViroARTrackingReasonConstants.TRACKING_REASON_NONE

state value one means AR Camera position is not available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions