Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by ScotchBunny · Mar 31, 2017 at 12:24 PM · androidinputtouchradius

Touch radius always returns zero on Android

I am trying to use Touch.radius (as well as radiusVariance) on my Galaxy S7 and I only get zero:

https://docs.unity3d.com/ScriptReference/Touch-radius.html

I get numbers with the Touch Radius Test app:

https://play.google.com/store/apps/details?id=com.bzgames.touchgraph

Am I missing a build setting or is it a device compatibility issue?

The code is below and it reports positions X and Y just fine.

 using UnityEngine;
 using System.Collections;
 
 public class TouchTest : MonoBehaviour {
 
     Touch currentTouch;
 
     int count = 0;
     float radius = 0;
     float variance = 0;
     float min = 0;
     float max = 0;
     float pressure = 0;
     float x = 0;
     float y = 0;
 
     // Use this for initialization
     void Start () {
         Screen.orientation = ScreenOrientation.Portrait;
     }
     
     // Update is called once per frame
     void Update () {
         if (Input.touchCount > 0) {
             
             count = Input.touchCount;
 
             currentTouch = Input.GetTouch (0);
 
             radius = currentTouch.radius;
             variance = currentTouch.radiusVariance;
 
             min = radius - variance;
             max = radius + variance;
 
             pressure = currentTouch.pressure;
 
             x = currentTouch.position.x;
             y = currentTouch.position.y;
 
         } else {
             
             count = 0;
         }
     }
 
     void OnGUI () {
         GUI.Label (new Rect(0,0,100,100), "Radius: " + radius);
         GUI.Label (new Rect(0,50,100,100), "Variance: " + variance);
         GUI.Label (new Rect(0,100,100,100), "Min: " + min);
         GUI.Label (new Rect(0,150,100,100), "Max: " + max);
         GUI.Label (new Rect(0,200,100,100), "Pressure: " + pressure);
         GUI.Label (new Rect(0,250,100,100), "Touches: " + count);
         GUI.Label (new Rect(0,300,100,100), "X: " + x);
         GUI.Label (new Rect(0,350,100,100), "Y: " + y);
     }
 }

EDIT: I just confirmed it's the same case with my Galaxy Tab S tablet :/

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 hexagonius · Mar 31, 2017 at 01:21 PM 0
Share

can we see the code? maybe you're not Reding a fresh touch Information every frame, but the touch from the first.

avatar image ScotchBunny hexagonius · Apr 03, 2017 at 09:14 AM 0
Share

I just added the code.

avatar image hexagonius ScotchBunny · Apr 03, 2017 at 08:13 PM 0
Share

yeah, that's bogus. I think that's a bug alright. you should report it.

0 Replies

· Add your reply
  • Sort: 

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

174 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 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 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 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 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 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 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 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

Please Help Im confuse im beginner in using unity. 1 Answer

Player follow touch when holding down your finger on the screen (C#) 1 Answer

How to pick up an object when touching a button(Mobile) 0 Answers

Non-responsive touch controls after showing ads. 0 Answers

Massive lag spike on first Input.GetTouch with nothing on scene but one script (Android) 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