Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 LordZephyr · Sep 16, 2012 at 10:31 PM · iosjavaswipepersonfirst

How do I Javascript swipe to move my first person?

Hi, all. I'm creating a very simple information based app with Unity. My first person character is in a small area looking around. I know this would be really simple but I don't know where to find the information. I would like to NOT use joysticks but I want the user to "swipe" left to turn left and "swipe" right to turn right. I code in Javascript. Can someone please direct me to where I may find this information? I looked on old Answers postings but all I can find is scripting that just has the swipe info and not how to turn the first person character.

Thanks so much for any help you may offer. Tom

Comment
Add comment · Show 3
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 AlucardJay · Sep 16, 2012 at 11:41 PM 1
Share

These links should help :

http://wiki.unity3d.com/index.php?title=Basic_iOs_Input_Tutorial

http://answers.unity3d.com/questions/188202/swipe-gesture-ios.html

http://forum.unity3d.com/threads/48601-Swipe-help-please

http://answers.unity3d.com/questions/292333/how-to-calculate-swipe-speed-on-ios.html

avatar image LordZephyr · Sep 17, 2012 at 04:16 AM 0
Share

Dear @alucardj Thank you for your links. The forum one I had found earlier while looking and when I used the script in Unity, it came back as an error of being out of date. I will work with that one again and the others. I really appreciate your help.

The only problem is that you didn't post your links as an answer so I can't check it as being the answer to my question. I want you to get credit for it since it did answer my question. $$anonymous$$

avatar image AlucardJay · Sep 17, 2012 at 08:36 AM 1
Share

I'm glad that helped. I thought you would find from these links how to detect a swipe movement, and from that create variables that could be used to move or rotate a character. I shall convert this to an answer for you, if you have any problems implementing your swipe into your character, ask in a new question and most likely someone shall help.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by AlucardJay · Sep 17, 2012 at 08:37 AM

These links should help with how to detect a swipe movement, and from that create variables that could be used to move or rotate a character :

http://wiki.unity3d.com/index.php?title=Basic_iOs_Input_Tutorial

http://answers.unity3d.com/questions/188202/swipe-gesture-ios.html

http://forum.unity3d.com/threads/48601-Swipe-help-please

http://answers.unity3d.com/questions/292333/how-to-calculate-swipe-speed-on-ios.html

Comment
Add comment · Show 1 · 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 AlucardJay · Sep 17, 2012 at 11:44 AM 1
Share

There is a basic answer I did on this question : http://answers.unity3d.com/questions/289055/rotate-on-drag-for-ios.html .

It basically uses the changes in touch.deltaPosition. $$anonymous$$uch more can be done than this i.e. for swiping and scrolling menu's, this is done by recording the last and current touchPosition, calculating the difference and stores for the difference between frames, touch.deltaPosition returns the same thing so for direct Inputs such as controlling a gameObject then touch.deltaPosition should be fine. Here's a link to an answer I wrote that records the changes in touch positions : http://forum.unity3d.com/threads/142758-$$anonymous$$oving-objects-with-your-finger

Just treat touch inputs like any other input e.g. Input.GetAxis returns a value between -1 and 1, so if you write your code imagining any input is between -1 and 1, it becomes easier to regulate the gameObject movements with : [input] speed Time.deltaTime;

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

11 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

Related Questions

Mobile FirstPersonSetup Controls Disappeared? 2 Answers

Help with jump 0 Answers

First Person Controller vs. Character (Penelope Tutorial) 2 Answers

How to calculate swipe speed on iOS 2 Answers

Can i make a first person shooter MMO with unity? 2 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