You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
I was trying to manipulate a flight in space based on where the person looks. Todo that I need camera.getWorldDirection(). Is there a way to get access to the camera within a component?
The text was updated successfully, but these errors were encountered:
No you cannot access the camera directly within a React component, as the camera is on the runtime / three.js side of things. So you would need a Native Module or get a reference to the camera from the VRInstance in client.js (more on that in Issue #43)
If you just want the orientation of the camera (say, to make items move with it), we provide a utility called VrHeadModel which receives updates from a Native Module.
import {VrHeadModel} from 'react-vr';
const position = VrHeadModel.positionOfHeadMatrix();
const rotation = VrHeadModel.rotationOfHeadMatrix();
const horizFov = VrHeadModel.horizontalFov();
const vertFov = VrHeadModel.verticalFov();
It uses our internal MatrixMath module to produce these results, creating basic JS arrays containing the data from these vectors / matrices.
Description
I was trying to manipulate a flight in space based on where the person looks. Todo that I need camera.getWorldDirection(). Is there a way to get access to the camera within a component?
The text was updated successfully, but these errors were encountered: