Gyroscope sensor for vr
In the constructor of SimpleVRClass in simpleVRClass.cpp, we place the GLES camera and the center of the OBJ (the cube, ourWorld.obj) at the origin in worldspace:
This trick is used in many games that have an artificial environment as the backdrop when a player moves around. The pictures are clicked or created in such a way that if the camera is placed inside the cube, then it creates the illusion of being in an virtual environment. These six images form a so-called “skybox” in OpenGL. Here are pictures of our virtual world from a distance: It’s just a cube! ? We have created a cube and chosen an image as the texture for each of its six faces. assets/ourWorld: The directory contains OBJ, MTL, and JPEG files that define a virtual environment.The only changes are that this file loads a 3D model corresponding to a virtual world and implements methods to translate sensor readings to a MVP matrix. jni/nativeCode/simpleVRClass/simpleVRClass.cpp: It is based on modelAssimp.cpp.Its JNI calls are implemented in sensorClass.cpp. java//SensorClass.java: This file implements methods to read data from accelerometer and gyroscope sensors.We have only retained the double-tap gesture detector and deleted the rest. java//GestureClass.java: It is a simplified version of a file with the same name in an earlier tutorial.It’s JNI calls are implemented in simpleVRActivity.cpp. java//SimpleVRActivity.java: It contains the only activity of the project and is similar to AssimpActivity.java from the previous project except for instantiation of a SensorClass.We mention the files that are different than the previous project (paths are relative to /app/src/main): This project is similar to the previous project, with addition of few files and simplification of few files. If your device supports a different ABI, then please get in touch with me for the required libraries. It also requires devices with ABI armeabi-v7a.
#Gyroscope sensor for vr android
The project will run on Android devices that have both a gyroscope and an accelerometer.
You can find more instructions to compile the project here.