I'm using a ViroViewScene to show a virtual environment, and I need to navigate it around the origin by using the devices's sensors (only the rotation). It's kind of working, but it's not a 100% working solution. Is this approach the correct one?
Node pointOfView = new Node();
Camera camera = new Camera();
camera.setPosition(new Vector(0, 1.6f, 0));
pointOfView.setCamera(camera);
viroView.setPointOfView(pointOfView);
viroView.setFrameListener(() -> camera.setRotation(orientationHelper.getQuaternion()));
I'm using this one as the orientation provider. All I do then is:
public com.viro.core.Quaternion getQuaternion() {
orientationProvider.getQuaternion(tmpQuaternion);
com.viro.core.Quaternion qq = new com.viro.core.Quaternion(tmpQuaternion.x(), tmpQuaternion.y(), tmpQuaternion.z(), tmpQuaternion.w());
return qq.invert().multiply(com.viro.core.Quaternion.makeIdentity().makeRotation(-90f, new Vector(1f, 0, 0)));
}
A couple of notes regarding this "almost working" solution:
The Quaternion needs to be inverted
Then rotated 90 around X
The Scene looks good (or not) based on where the user is pointing at <- weird?
This is 100% custom. Do you guys have a working example of this?
I'm using a ViroViewScene to show a virtual environment, and I need to navigate it around the origin by using the devices's sensors (only the rotation). It's kind of working, but it's not a 100% working solution. Is this approach the correct one?
I'm using this one as the orientation provider. All I do then is:
A couple of notes regarding this "almost working" solution:
This is 100% custom. Do you guys have a working example of this?
Thanks