- Home /
Object rotation speed different on mobile
Hello! As you can understand from the title, i have some rotating objects in my scene that on mobile rotate slower than on unity game panel. This is not a performance issue since i have other objects that rotate at the same speed both on unity and on mobile. What can cause this?
Are you doing those rotations in FixedUpdate? This is probably a difference in the Fixed TimeStep.
Check under Edit > Project Settings > Time to show the Time $$anonymous$$anager.
Unity defaults at 0.02, this is 50Hz. Now iOS runs at 60Hz, so you have to change the Fixed TimeStep to 0.0166667.
This is just a suggestion. Now I think, this would mean your objects rotate faster. The other thing to check is are you using deltaTime , fixedDeltaTime or smoothDeltaTime ? this is all I can think of, sorry.
I'm developing this game for android. Do you know if there's a standard hertz value for android os?
Sorry , I have no information on Android. If the many screen resolutions are anything to go by, then with all the different CPU's there is probably no standard. I did a quick search, but maybe you should include a FPS display in your test build to deter$$anonymous$$e what your target device is running.
http://stackoverflow.com/questions/2265089/android-game-loop-how-to-control-speed-and-frame-rate
http://www.mysecretroom.com/www/program$$anonymous$$g-and-software/android-game-loops
http://answers.unity3d.com/questions/208094/how-to-change-framerate-for-android.html
Answer by tmdchi · Nov 13, 2012 at 10:30 AM
Are you multiplying your rotation value by Time.deltaTime? That should take care of any framerate difference between devices, and also adjusts itself depending where you use it (Update or FixedUpdate).
no i'm not because in this game there's a slide bar that changes dinamically the time.scale but i need the objects to keep rotating at the same speed ignoring the time scale so i just used a fixed float number, eg. "rotate(Vector3.up*0.5)"
If you want to ignore the timeScale in certain objects, then just multiply the rotation by (Time.deltaTime / Time.timeScale). Not using deltaTime will always have inconsistent results, such the ones you're having.
Thanks! dividing by Time.timeScale worked! now both the Unity game panel and the game on mobile have the same speed!
Unless you multiply your rotation by Time.deltaTime, it will be framerate dependent, so it will rotate generally much faster in the editor than on your device. Please read the documentation for Time.deltaTime.