• 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 Daruom · Apr 14, 2015 at 11:30 AM · movementsmoothjitter

Is't impossible to move an object without jittering

Hi,

I try to move an object but it seems impossible to have a jitter-free movement.

I already published the game : https://play.google.com/store/apps/details?id=com.MDevApp.JumpingBall In t$$anonymous$$s version, i used t$$anonymous$$s code ( Rigidbody2D + is Kinematic On)

 public Vector2 speed = new Vector2(0,-5);
 public float range =1.7f;
  
 void Start () {
  
         GetComponent<Rigidbody2D> ().velocity = speed;
         transform.position = new Vector3 (transform.position.x - range * Random.value, transform.position.y,transform.position.z);
       }

 

I also tried : - Translate ( without Rigidbody2D) - Add force ( with Rigidbody2D + is Kinematic Off) - Character controller

Each time i tried with Update(),FixedUpdate() and switc$$anonymous$$ng between Time.deltaTime, Time.FixedeltaTime and Time.smoothDeltaTime, Turning VSync On/Off, changing FixedTimestep to differents values (0.0166 for example),Interpolate/Extrapolate. I really tried everyt$$anonymous$$ng i found on forums.

I tested the game on many devices and for some of them the movement looked smooth but for others the jittering was obvious.

So i really want to know, is't impossible to move an object without jittering or am i missing somet$$anonymous$$ng.

Thanks.

Comment
Add comment · Show 14
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 Daruom · Apr 13, 2015 at 10:35 AM 0
Share
avatar image cobertos · Apr 14, 2015 at 01:52 PM 0
Share
avatar image Daruom · Apr 14, 2015 at 06:52 PM 0
Share
avatar image cobertos · Apr 14, 2015 at 06:56 PM 0
Share
avatar image Daruom · Apr 14, 2015 at 07:19 PM 0
Share
Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ironblock · Apr 14, 2015 at 11:39 AM

you shuild use time.delta time to maka a smoth transision float MovementSpeed = 2;

 transform.position += transform.forward * Time.deltaTime * MovementSpeed;
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 Daruom · Apr 14, 2015 at 12:39 PM 0
Share
avatar image
0

Answer by spalmer · Apr 15, 2015 at 06:24 PM

Time.deltaTime is wrong for FixedUpdate, should be Time.fixedDeltaTime there. The rigidBody definitely needs set to kinematic if you're messing with position directly like t$$anonymous$$s. One of the myriad problems doing motion t$$anonymous$$s way is the physics engine must then extrapolate the positions to obtain a velocity; if it doesn't do t$$anonymous$$s or fails somehow it won't be able to reconstruct interpolated positions for the intermediate rendered frames properly. Another is that you're bypassing intermediate space for collision, including any continuous collision detection it may provide. You're not supposed to teleport objects in a physics simulation. You should just set a velocity on the rigidBody and let the physics engine manage the position like it was designed to do.

Comment
Add comment · Show 2 · 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 Daruom · Apr 15, 2015 at 06:39 PM 0
Share
avatar image cobertos · Apr 15, 2015 at 06:58 PM 0
Share

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Smoothly move 2D Sprite 2 Answers

How to realise smooth drag movement like any bouncing ball games have (iOS/Android) 1 Answer

Advanced smooth Camera transition 1 Answer

Smooth Flashlight Movement 1 Answer

The Cube object moves through other cube objects and does not move smoothly on other cube objects,Cube object moves through other cube objects and does not move smoothly 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