I am trying to do an accelerometer and I got all figured out but I can't rotate my marker on the rectTransform Z axis and maintain X=0 and Y=0 the closest I could get was : AngletoRotate is a value between 0 - 230 rectTransform.rotation = Quaternion.Euler(0, 0, AngletoRotate); this one works perfectly but when I move my camera it also moves the marker... I recorded a video of what I want and the problem I am having: At the beginning of the video, you will see it working properly but when I decide to rotate the camera it breaks. I don't know how to fix it ...Pls help =(
its 0 to 230 I have the math done already for getting the value. the problem is making unity do the rotation. I know the angle rotation in Z i want is float AngletoRotate = 230 - ((percentageMagnitude) * (MaxTreshhold - MinTreshHold) * -1); but caling is not the correct way to go . rectTransform.rotation = Quaternion.Euler(0, 0, AngletoRotate); I want to hard set the rotation to the values (0,0,AngletoRotate) but I don't know how to do this
I think I found the solution. It was rectTransform.rotation = Quaternion.Euler(rectTransform.eulerAngles.x, rectTransform.eulerAngles.y, AngletoRotate); instead of : rectTransform.rotation = Quaternion.Euler(0, 0, AngletoRotate); wwhat a nightmare... well thansk anyway zxc76_die