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 billythegoat · Dec 04, 2014 at 01:52 AM · 2dmovementsprite

Sprite with non-constant jitter during constant velocity movement.

I know how many people have asked a similar question before, and I've read each one a thousand times, but this one is slightly different and I can't figure out how to fix it, but I know the solution is probably very similar.

I have sprites with rigidbody2D, and a movement script attached, the script just makes them move in the negative y direction forever. Very simple movement.

 void Update() {
     float rigidVelocity = 100f * Time.deltaTime;
     
     transform.rigidbody2D.velocity = new Vector3 (0, -rigidVelocity, 0);
 }

For some reason, every second, it seems to move with jitter, then the next second it's perfectly smooth, then the next second jitter, next second smooth. I have no idea why. Before, I was using a unity sphere and it was perfectly smooth, i switched to sprites and it became jittery, but the 1 second smooth 1 second jitter pattern confuses me. I'm sure it's a super simple fix, but I can't seem to figure it out.

Comment
Add comment · Show 8
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 MrSoad · Dec 04, 2014 at 12:02 AM 0
Share

1) You need to do this in FixedUpdate() not Update().

2) You may also want to try using add force rather than directly modifying the velocity, this may not end up being better but it is another method that you can try :

http://docs.unity3d.com/ScriptReference/Rigidbody2D.AddForce.html

http://docs.unity3d.com/ScriptReference/Force$$anonymous$$ode2D.html

3) Check your rigidbody interpolate settings for smoother movement in between FixedUpdate()'s

avatar image billythegoat · Dec 04, 2014 at 01:20 AM 0
Share

I've tried all of that and more. I just don't get why it works half the time and then the other half it randomly is jerky, almost like the sprite is going ahead 1 frame and staying behind 1 frame at the same time before eventually settling on the right subsequent frame. It's so baffling.

avatar image MrSoad · Dec 04, 2014 at 01:24 AM 0
Share

Do you have Unity Pro? What code are you using at the moment?

avatar image billythegoat · Dec 04, 2014 at 01:32 AM 0
Share

No, just Unity Free and c#.

avatar image MrSoad · Dec 04, 2014 at 01:36 AM 0
Share

No profiler then, which would say what is causing the jitter if it is not this script... Have you done what I said in number 1 above, that is a must do if you have not done it already!!!

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Komak57 · Dec 04, 2014 at 07:59 PM

There are quite a few terms for what "Jitter" defines. Frame spikes can be due to other scripts getting stuck in a long loop trying to process data in the Update() event. Non-frame spikes could be the result of either Floating Point inaccuracies due to rounding (effects you more the farther from Vertor3.Zero you are). Non-frame spikes could also be due to you having more than one collider on an object that in some frames, affects one of the other colliders. It's like the world telling you this object is a Siamese twin, but you're both fighting to stay separate. Additionally, I've found the background profiler in unity will cause spike data on garbage collects, and some background processes and services can generate steady hiccups in games as simple as Minecraft.

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 blackmodjo · Feb 10, 2015 at 09:32 PM

Man i had the same issue but i fixed it by going to my prefab that had the sprite and in the rigidbody in the interpolate i used the extrapolate value.

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

6 People are following this question.

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

Related Questions

When i make my character animated, he can only move up, down left and right (2D) (JS) 0 Answers

Having Issues Rotating 2d Sprites to face another 2d Object 3 Answers

[2D] Camera movement causes flickering/jittering sprites 2 Answers

Change sprite when moving(2D) 1 Answer

Question on Sprite and Movement 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