Are there anybody now how to make a tilt control for mobile.?
Thanks.
There’s a few builtin functions you can use for the accelerometers. There’s Tilt, Gravity, Acceleration and Rotation Rate. Best thing to do, and is what I did to get a semblance of how each one was affected, is drop each of those functions in a player controller graph and one at a time for testing, hook it up to a print string and have it print out the functions Axis Values to the screen. Then deploy or launch the project to your mobile device in the correct orientation according to your desire and then tilt away, taking note of which value is affected based on the direction you tilt. Do this for each one. From there it is easy to decide which one you want to use for the action you want to take.
Tilt and gravity are, I believe, your basic tilt style functions but both have different resulting outputs but are affected in the same way.
The Acceleration and Rotation Rate, I believe, is for things like shaking your phone. Acceleration I think is the vertical shaking (up/down) and Rotation Rate is the speed you shake it while “twisting” from left to right.
As far as giving you specific direction on how to “make mobile controls” it is hard to do because there is a million things you can make each function do. Once you have the values from your tests above, you just use those to get your values needed for the commands you want. Mobile controls are the exact same as a PC control only you are using the above functions to get your values to manipulate your movements.
Hope this helps! If it does, please consider clicking the check mark next to the answer to accept it. You’ll know you got it right when the answer turns green.
NOTE: Making a comment after accepting an answer will deselect the answer as accepted.
could you tell me which of those is the most proper option to rotate camera if I take my phone horizontally?
I found that the gravity Y is the best one to use with add controller yaw input and the gravity X for add controller pitch input
and the rotation rate is almost good but you have to rotate your phone 360 degrees to rotate the camera 360 degrees and also does not have any effect when shaking left and right as you said in your answer
and tilt seems to be good only for board games like a rolling sphere crossing through holes and traps because for example you cannot change controller pitch independent of its yaw using tilt
and acceleration works with shaking and sudden movements which is good for dropping dice
@jtsmith is there any setting for this, I am trying this in my project but none of the values is being shown instead 0. also i have enabled “Enable Gesture Recognizer” and “Allow IMU Sampling” both are true.
Not that I can think of. It’s been awhile since I’ve worked with mobile controls though. Sorry I couldn’t be of more help