Hi, I am trying to find a work around for a bug that swaps the X and Y axis when I’m using an android device, It works perfectly fine on my iPhone 7 but switches the X and Y axis on my Google Pixel 1.
The head on the right side of the video is my Google pixel and the head on the left is my iPhone, I am doing to exact same rotations on both devices and it is completely switching the axis. Both devices are also in portrait mode and calibrated.
I found a bug report from 2019 addressing it. I believe if I could check if the user is on IOS or android then I could swap the axis to make it work properly, but the problem is I do not know if that is even possible.
Here is the main code that controls the rotation if that helps but I’m pretty sure that it only is happening because of the Roblox bug, also I might have accidently left out a few lines since its spread apart.
local DeltaVar, Gyroscope = UIS:GetDeviceRotation()
local UIS = game:GetService("UserInputService")
local RootCF = Cam.CFrame
local UPSDN = (UIS:GetDeviceGravity().Position.X < -.5 or UIS:GetDeviceGravity().Position.Z > .5)
local CRROT = Cam.CFrame
local LIF = nil
if LIF == nil then
LIF = Gyroscope
end
local DTA = Gyroscope*LIF:Inverse()
local X,Y,Z = DTA:toEulerAnglesXYZ()
if UPSDN == true then
DTA = CFrame.Angles(-X,Y,Z)
else
DTA = CFrame.Angles(X,-Y,Z)
end
CRROT = CRROT*DTA
LIF = Gyroscope
Cam.CFrame = CFrame.new(TargetCFrame.Position)*CFrame.Angles(CX,CY,CZ)
Cam.CFrame *= CFrame.Angles(Y,X,Z)
RootCF = (Cam.CFrame*CFrame.new(-SideDistance,-Height,-Distance))