- Home /
Best free way to control a first person character on a mobile device
What is the easiest, free way to easily aim a cursor accurately while still being able to turn around 180 degrees. I've had a LOT of headaches finding the best way but I want to hear it from someone who knows what they are doing. I am basically making a third person shooter, and i want you to be able to put a little cursor on enemies to shoot them. But with a standard joystick its hard to be accurate, and with a touchpad you can make it aim accurately, but then it is a hassle to turn around 180 degrees because you have to swipe many times. How do you guys do it?
Answer by Veldars · Jul 23, 2015 at 06:08 AM
Hi,
In my game I've worked on a touchpad with a max range. So when you reach this max range the touchpad will work as a joystick (automaticlly continue to turn), else in his (min/max Range it's like a touchpad and so accurate to taget an ennemy).
im relatively new to program$$anonymous$$g and unity, and i can program quite well for being 15 and everything, but I don't think i am capable of making mobile input that just feels RIGHT do you know what i mean? I'll get there someday, but right now, I think thats a little out of my capabilities. $$anonymous$$abye you could send me some of your code or mabye there is an asset that i could look at? If you let me look at the code you wrote ill understand it so i can get better in the long run
A system like this should be easy to implement. I mean I've never developed for touch pad but the answer was practically given to you! As a developer, you'll need to think through problems like this logically.
To me, seems like the next step would be to figure out how to get touch position on screen. Google reveals Touch.position pixel coordinates--Now that you have position you can reference it back to Screen.width and Screen.height. From there you get a percentage of the coordinates relative to screen space (0, 0). Then it would be no work at all to make a check. if (screenPercentage.x < .1 || screenPercentage.x > .9) RotateCharacter();
If you solve problems one step at a time, you'll know what to look for in the documentation.
Answer by ScienceIsAwesome · Jul 23, 2015 at 10:04 PM
I think the most interesting approach to this I've ever seen is to use the inertial measurement unit, that way you can stand in the middle of a room and use the mobile device to look around as if you're actually inside the game :)
It might be a little laggy or imprecise, depending on the IMU, but you could compensate by using the location of the screen tap to further point the weapon (tap right on the enemy to shoot the enemy).
How quickly can you personally turn 180° on the spot? :)