-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Description
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
When I run in MQ3
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.
gfaraj, JorgeArmandoMT and Arvrairobo
Metadata
Metadata
Assignees
Labels
No labels

