how to flip x axis for rotation on gameobject

So I have a gyroscope constantly feeding values into unity to update a gameobjects rotation, only problem is that the sensors input of +x is unity’s version of -x.

Its giving me the values in forms of quaternions so I cant edit the direct values there unlike flipping the yaw in yaw pitch and roll euler angles, and since the values are constantly updating I cant make the x angle negative. I tried re-orienting the gameobject but when the x gets un-flipped then the y gets flipped instead. Only solution I could think of is flipping the x-axis in unity, but I dont know how to do that. Is this possible? And if not what else can I do?

Any input is appreciated. Thanks! =)

I know it’s usually a big no-no to touch Quaternion values directly but I believe this will do what you need (I’m interpreting what you need as “mirroring the rotation on the X axis”. Let me know if it’s something different you’re looking for…)

public static Quaternion MirrorOnXAxis(Quaternion q) {
    q.y = -q.y;
    q.z = -q.z;
    return q;
}

Just remember this doesn’t modify the Quaternion you pass in, it returns a new copy with the “fixed” x axis.

well, that didnt work at first and I had the same problem, but i tinkered with the values of the quaternion so it was -z and -w, and that fixed it, but now the rotation on the z-axis is flipped… Quaternions confuse me xD