World Tracking and Orientation With expo.AR

Hello,
I’m wondering how to get the phone position and orientation in the real-world from the origin point using expo.AR?
With AR-Kit, the ar.frame.camera has this data.

I have looked at the expoThree, expo.AR, and expo-graphics API, but they are not very comprehensive, not all the attributes or methods seem to be there.

I have the GraphicsView (expo-graphics.View) in a View element that grabs a user’s touch, and I want to log the world position when the user taps on the screen. I have the demo from:
https://docs.expo.io/versions/latest/sdk/AR/

With the following functions added or modified:

constructor(props){
	super(props)
	this.state = {buttonText:"Nothing"}
	this.handleClick = this.handleClick.bind(this)
}

handleClick(){
	this.camera.updateMatrixWorld()
	console.log(this.camera.position)
	this.setState({buttonText:"Clicked!"})
}


render() {
	// You need to add the `isArEnabled` & `arTrackingConfiguration` props.
	// `isArRunningStateEnabled` Will show us the play/pause button in the corner.
	// `isArCameraStateEnabled` Will render the camera tracking information on the screen.
	// `arTrackingConfiguration` denotes which camera the AR Session will use. 
	// World for rear, Face for front (iPhone X only)
	return (
	<View onResponderRelease={this.handleClick} onStartShouldSetResponderCapture={()=>true}>
		<Button title="Cheese"></Button>
		<Text>{this.state.buttonText}</Text>
		<GraphicsView
			style={{ flex: 1 }}
			onContextCreate={this.onContextCreate}
			onRender={this.onRender}
			onResize={this.onResize}
			isArEnabled
			isArRunningStateEnabled
			isArCameraStateEnabled
			arTrackingConfiguration={'ARWorldTrackingConfiguration'}
		/>
		</View>
	);
}

Is this the correct topic “How to” to post this question?

I have managed to find how to do this in WebXR, but I don’t think React Native supports WebXR yet. In WebXR, the function I am looking for is XRSession.requestReferenceSpace(‘unbounded’)
Any ideas how to do this in the AR module?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.