Android Question Sensor reading problem (opengl 3d game)

MasterGy

Member
Hello Everyone!

I've started working with the B4A development environment about 10 days ago. Initially, it wasn't very user-friendly, but I've managed to grasp the basics. I aim to create an easily manageable, ergonomic control system in the 3D space where I, as the viewpoint, perceive the world, based on my movements. It was quite challenging, but I've succeeded in drawing the space around me using OpenGL.

I enjoy developing games; for instance, I created this one in QB64:

I've noticed that a game dies if it's either boring or difficult to control. No one will feel inclined to play if they struggle with controlling their character.

Therefore, I'm currently working on designing a user-friendly control mechanism in 3D mode, in first-person perspective. Recently, I implemented motion control for the player using the accelerometer. However, it's not functioning well. I've tested it on several phones, and it seems that while the accelerometer function often provides data, it only gives accurate readings about 3-4 times per second. As a result, the display lags because many aspects rely on this data. I've read through various topics within B4A but haven't found a solution.

How can I regulate the accelerometer query?

I've attached the program. Accelerometer querying experiences lag on three other phones besides mine. What should I do to ensure smooth performance?

Even attempting to dampen data fluctuations with this trick:

DATA = DATA + (NEW_DATA - DATA x 0.9)

doesn't yield improvement; it just slows things down.

I know that the hardware is capable of greater precision.

So, overall, I'm facing issues with reading.

My questions are:

  • How can I execute the ACCELEROMETER reading function at intervals defined by me?
  • How can I trigger the ACCELEROMETER reading when the displacement exceeds a certain threshold?
  • How should I approach this problem in general?
 

Attachments

  • fps_opengl_mastergy_sensor2.zip
    253.9 KB · Views: 23
Top