Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by matta9001 · Jul 23, 2015 at 05:11 AM · uimobilecontrolssimple

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

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).

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image matta9001 · Jul 23, 2015 at 09:32 PM 0
Share

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

avatar image SomeGuy22 · Jul 23, 2015 at 09:47 PM 1
Share

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.

avatar image
1

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? :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Cross Platform Input touchpad acceleration 1 Answer

Mobile Controls? 0 Answers

when i drag my finger on mobile screen gameobject move left or right but not follow my finger 1 Answer

Touch input problem 1 Answer

Is WebGL compatible with mobile controls/platform? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges