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
1
Question by Jort · Nov 25, 2014 at 06:56 AM · movement script

Touch movement too slow

Hello,

I have an object I'm moving along the x pane (on android) with the following script

 using UnityEngine;
 using System.Collections;
 
 public class controls : MonoBehaviour {
 
 
     void Start () {
     
     }
     
 
     void Update () {
         if (Input.touchCount > 0) {
 
             Touch touch = Input.GetTouch(0);
             
 
         
                 Vector3 touchPosition = Camera.main.ScreenToWorldPoint(new Vector3(touch.position.x, touch.position.y, 10)); 
                 touchPosition.y = transform.position.y;
                 transform.position = touchPosition;
 
         }
 
     
     }
 }

Currently the object is moving after the finger when the movement speed of the finger is higher. Is there a way I can make the object stay underneath my finger at all times?(so it doesn't look like it's slower then the actualy finger touching the screen)

Comment
Add comment · Show 2
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 SaraCecilia · Nov 25, 2014 at 01:42 PM 0
Share

Check this thread out: http://answers.unity3d.com/questions/733589/unity-touch-controls-accurate-finger-following.html

avatar image NoseKills · Nov 25, 2014 at 02:50 PM 0
Share

The linked example is about the mistake of not converting screen pixels to world units, which @Jort is doing correctly from what i can see.

I've experienced the same issue where there's some lagginess when moving objects in Update. Haven't really investigated this since it was never a real problem for me.

You can see this clearly on an Android device when you turn on the touch position markers in the OS debug settings. The OS's markers stay under your finger but objects in Unity lag.

Either it's just that Update doesn't get called often enough (depends on the frame rate setting) or that Unity does some smoothing of the touch position behind the scenes...

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

28 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

Related Questions

How to get objects with the same script to act independently? 2 Answers

Player Sliding without any Input 2 Answers

How to maintain speed on the x axis according the last key pressed ? 2 Answers

Character Transform shifting after colliding with objects 0 Answers

I want to move the object more smooth way 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