Trouble with Tilt using Input.gyro.attitude

Hello all,

I’ve been breaking my back over this problem for the past few days. I’ve been researching the problem, and Quaternions, and gyro input for a while to no results. I’m somewhat new to using Quaternions.

Basically, I’m making an endless runner that uses the tilt of the phone to turn the player (not unlike temple run’s tilting, but it turns instead of strafing).
I ONLY need the horizontal tilt of the phone, and nothing else at all. I’ve gotten this to work in prototypes if you keep the phone still in the same orientation and position, but I have had very little luck once you start moving around. Ideally, I’d like a solution that lets the player hold the phone wherever they need.

My current code is broken (hacked it to bits in frustration, ha), but I’ve been basing my code off of this forum post:

That does just about what I’m looking for, but with z rotation instead of y.

Thanks.

it’s really hard to see where you’re going wrong if you don’t provide your code for us to see. Without seeing that, I can only advise working with quaternions via eulerAngles and euler functions to convert to xyz representations which are easier to understand and then turning it back into a quaternion for use in the code.