- Home /
Rotation on Android vs. PC
So here's my problem. All of my calculations are correct, but I have a problem with using rotation like this:
transform.rotation = Quaternion.AngleAxis(CalculatedCurrentAngle, Vector3.up);
The above always seems to flip the axis on Android, but works fine on PC. It only flips it when I begin to apply a rotation. After that, it will just kind of flip back and forth for some reason.
These lines have the same effect. Mind you they both work find on PC.
transform.localRotation = Quaternion.Euler(0.0, CalculatedCurrentAngle, 0.0);
It's imperative that I be able to set the exact value. Torque works and doesn't present any kind of problem except for the fact that I can't rotate the object with physics to an exact position without using some sort of 'snapping'. I know it's not the calculations considering I have all of the variables visible and I continuously monitor them. Also, it works fine on PC as I said earlier.
Here's everything I tried:
} else if (Switch == true) {
if (SecondPoint != PreviousPoint) {
if (SecondPoint < PreviousPoint) {
//transform.rotation = Quaternion.AngleAxis(CalculatedCurrentAngle, Vector3.up);
//rigidbody.constantForce.torque = Torque;
//transform.Rotate(0, StandardRotationSpeed, 0);
transform.localRotation = Quaternion.Euler(0.0, CalculatedCurrentAngle, 0.0);
} else if (SecondPoint > PreviousPoint) {
//transform.rotation = Quaternion.AngleAxis(CalculatedCurrentAngle, Vector3.up);
//rigidbody.constantForce.torque = -Torque;
//transform.Rotate(0, -StandardRotationSpeed, 0);
transform.localRotation = Quaternion.Euler(0.0, CalculatedCurrentAngle, 0.0);
} else {
}
}
}
Thanks, everyone. All of you have always been a great help.
Are you talking about physical changes to the objects, or are you talking about changes in what you read by when you read eulerAngles? If it is the latter, then you are out of luck and will have to come up with an alternate method of dealing with whatever you are trying to do with eulerAngles. 'eulerAngles' are derived from the rotation (Quaternion). There are multiple different eulerAngle representations for any given physical rotation.
It's basically a swipeable rotating menu. I think what I'll do is create a video showing everyone the exact problem. It's probably the only real way I can explain it.
Well, I basically took the easy way out. I just used another game object to drag the menu's rotation. Lame. I would still love to know how I can get perfect rotation on mobile though. This is the thing that ruined another project I was working on.
Anyway, if y'all experience the same problem and find a solution, let me know. I'll post more about this later when I get the time. I went to make a vid, but apparently before I went to sleep last night I broke it even more lol