• 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
Question by LimboWorld · Jun 27, 2014 at 12:02 PM · inputtouchjoystickswipe

Joystick Zone + Screen-swipe touch input clash. Solution???

Hello.

I'm making a 3d third person game for android/iOS. It has a main character in the middle of the screen that is controlled by a virtual touch joystick, and the screen can be touch-swiped across the screen to make the camera orbit around the character.

This is part of my script to rotate camera by screen swipe:

 void Update()
     {
         if (target && Input.touchCount == 1 && Input.GetTouch(0).position.x > Screen.width && Input.GetTouch(0).phase == TouchPhase.Moved) //Just orbit touch without movement
         {
             Debug.Log("Orbiting! 1 touch");        
                 Orbit(Input.GetTouch(0));

meaning if I touch anywhere on the screen and drag it, it will direct to a void that would rotate camera. However, my problem is I also have a joystick at the bottom left corner of my screen, so if I touch and drag the joystick to move, it will also rotate the camera which is not what I want.

When I touch the joystick region, I do not want the screen-swipe to interfere.

Are there any ideas as to how I can tackle this problem? I'm new to scripting C# so it would be much appreciated if answers are explaining for newbs.

Thank you.

Comment
Davud

People who like this

1 Show 0
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

1 Reply

  • Sort: 
avatar image

Answer by Graham-Dunnett · Jun 27, 2014 at 12:03 PM

Write code that works out where on the screen the Touch has started, and enable or disable your movement and orbit code accordingly.

Comment

People who like this

0 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta on June 13. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Joystick / Button 3 Answers

Detect if finger lifted off screen 1 Answer

iPhone - How to calculate a decent touch swipe speed? 2 Answers

How to accept swipe input when already touching with one finger. 1 Answer

How add click area? 1 Answer


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