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 mcdon00 · Sep 12, 2013 at 01:03 AM · iosdelta positiontouch.deltapositionipad mini

touch.deltaPosition different on different devices

I am using the Input.touches plugin to drag a game object horizontally across the screen. This, after some conditions is called in the OnDragging event:

    posX += (dragSpeed * e.delta.x);

posX is then added to a vector3 and set as the new position of the game object. dragSpeed is set with a constant.

My problem is that while it works fine for the device I developed on, when tested in other devices it is faster or slower.

I understand that the screen dpi or resolution plays a part, but I can't get a formula to correct it that works across all devices. I had a solution that worked between the android tab2, ipad4 and the ipod touch, but when I tried it on the ipad mini it was significantly faster.

I was taking the change in screen width and dpi from a bench mark dpi and screen width and increasing or decreasing the dragSpeed.

The only thing I can think of is that the frame rate is affecting it, but then I can't understand why my solution would work between an old iPod touch and an ipad4, but not the mini.

Comment
Add comment · Show 1
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 Rulogarcillan · Jan 14, 2017 at 05:14 PM 0
Share

How did you solve it?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Jjules · Jan 15, 2017 at 12:58 AM

Well I don't exactly understand the question, but I think one fundamental question is do you want the object to be pushed by how fast your finger slides, or do you want the object to imitate your finger's position on-screen? I found through multiple tests that the latter feels much more intuitive and natural, but there are reasons to do both.

If you're doing the latter, one thing you could consider is normalizing the input, meaning put it on a scale from 0-1. So where ever you plugged in the input in your code, replace that with a variable that's equal to the x input divided by screen.width and the y divided by screen.height. There probably be an easier to do this, but I can't think of it at the moment

Edit: Actually I just remembered one way. If you don't need multitouch, since unity automatically makes touch input emulate mouse input by default, you can use Camera.ScreenToViewportPoint(Input.mousePosition) instead. It's pretty accurate, and it's already normalized! I would try this to see if its the same across devices

That's all I got really. You posted very little code, which is crucial with this type of question, so I hope that helped

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
avatar image
0

Answer by mcdon00 · Jan 16, 2017 at 05:21 PM

In the end I managed to get a consistent delta position, by first converting the mouse input to world values:

Camera.main.ScreenToWorldPoint(Input.mousePosition);

then I created my own deltaPosition with that and used that instead of the touch deltaPosition

Probably not the best method to make it consistent, but it worked.

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

19 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

Related Questions

Problems with textures in ipad mini 2 0 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Delta touch trembling 0 Answers

Simulated iOS not rendering some textures that real hardware can 1 Answer

Forcing WiFi connection programmatically on iOs with Unity 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