Paul,
After having tested my phone for the maximum frequency for my android mobile phone sensors (https://play.google.com/store/apps/details?id=com.cochibo.accfreq) , i see that my LG G5 sensors can run at 200Hz max with the SENSOR_DELAY_FASTEST constant (so... capturing movements every 5ms). so i have searched into the AppGameKit player sources for the SENSOR_DELAY_GAME constant (but nothing was found :p) and i have found that AppGameKit use and set the minimum the sensors can do, while it's not under 16.667ms (60hz), as the screen rendering frequency (60fps) (which at first sight makes sense with sensors prediction algorithm ... but without a prediction algorithm, it's not sufficient) .... so i wanted to try to reduce the delay at the maximum...
To test that, i have commented out from the
C:\AGK_2.0.21\Tier 2\apps\interpreter_android_google\AGKPlayer2\src\main\jni\main.c file the following lines (but in VR and specifically with the GetRawRotationVectorW2,X2,Y2,Z2 i think only one or two sensors must be "boosted" ... gyro and rot vector ?) and i have recompiled with NDK ...
the result is impressive and movements are much smoother ! (but i can imagine removing theses lines can be a battery killer depending on the phone...) ) :
for the APP_CMD_GAINED_FOCUS and the APP_CMD_RESUME events :
...
if (engine->accelerometerSensor != NULL) {
ASensorEventQueue_enableSensor(engine->sensorEventQueue, engine->accelerometerSensor);
int minRate = ASensor_getMinDelay(engine->accelerometerSensor);
//if ( minRate < 16667 ) minRate = 16667; <================ COMMENTED OUT
ASensorEventQueue_setEventRate(engine->sensorEventQueue, engine->accelerometerSensor, minRate);
}
if (engine->gyroSensor != NULL) {
ASensorEventQueue_enableSensor(engine->sensorEventQueue, engine->gyroSensor);
int minRate = ASensor_getMinDelay(engine->gyroSensor);
//if ( minRate < 16667 ) minRate = 16667; <================ COMMENTED OUT
ASensorEventQueue_setEventRate(engine->sensorEventQueue, engine->gyroSensor, minRate);
}
....
if (engine->magneticSensor != NULL) {
ASensorEventQueue_enableSensor(engine->sensorEventQueue, engine->magneticSensor);
int minRate = ASensor_getMinDelay(engine->magneticSensor);
//if ( minRate < 16667 ) minRate = 16667; <================ COMMENTED OUT (not necessary for movement but maybe for magnetic trigger)
ASensorEventQueue_setEventRate(engine->sensorEventQueue, engine->magneticSensor, minRate);
}
if (engine->rotVectorSensor != NULL) {
ASensorEventQueue_enableSensor(engine->sensorEventQueue, engine->rotVectorSensor);
int minRate = ASensor_getMinDelay(engine->rotVectorSensor);
//if ( minRate < 16667 ) minRate = 16667; <================ COMMENTED OUT
ASensorEventQueue_setEventRate(engine->sensorEventQueue, engine->rotVectorSensor, minRate);
}
...
So my request is :
Please add, in the next version, a Tier1 command to specify the sensor and its refresh delay ! (0 for minimum autodetection with the min threashold at 16.6667 ... as today / or a INT in µs , or a float in ms, or a frequency... as you wish !)
Or a simple command "SetVRMode(1)" (which reduce the delay at the minimum when it is 1 for the VR dedicated sensors (gyro,rot,magnetic etc..)... and SetVRMode(0) to come back to previous intial frequency as calculated today)
Thanks in advance Paul !