When In Gyroscope Accelerate

Categories Blog, Gamedev0 Comments

I’ve spent the better part of the day trying various solutions to best implement the gyroscope control scheme in RunawayJRider…

I’ve had a few experiences with various gyroscopes throughout the years but steering….. hmmmm that’s a tricky one. At least not from the onset… actually let me rephrase… my first instinct was the eventual solution. Getting the forces applied on the device and using them to increment/decrement an angle value… but that seemed too easy.

Track all Axis… Hello Mr. Gimbal

If you’ve ever had to deal with rotations in 3-D space, then you must’ve heard of Gimbal-Lock. When two of the three axis of rotation are aligned then we lose one axis of freedom (video explanation). With the gyroscope these accelerations are recorded in the usual euler angles. Best advice is to use quaternions and then convert euler angles when needed. This has a meager perf hit due to an extra axis w but it avoids the lock. This iss akin to affine transformations where 4-Dimensions are used to keep track of 3-Dimensional objects.

Rely on Rotation Accelerations

The end solution is to use rotation accelerations and do some interpolations to mimic the steering wheel. This creates an “aided” rotation solution which creates the entertainment value at the expense of “realism/simulation”. Very important moral to keep in mind. Video games entertain, for the most part.

I wish I had more to share but this took quite some time due to going back and forth between various device builds.