• 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 /
This question was closed Dec 12, 2014 at 04:46 PM by MapuHoB for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by MapuHoB · Dec 12, 2014 at 02:49 AM · c#movementlagsmoothparallax

Why is the paralaxing shaky? (video examples)

https://drive.google.com/file/d/0ByYKDNm1mq0dVFNkZWlyZFV1ZVE/view?usp=sharing - 1st vid

https://drive.google.com/file/d/0ByYKDNm1mq0dY0ozcEtrck1vMTA/view?usp=sharing -2nd vid

http://pastebin.com/TZHBfMzy -the script for the obstacle movement

http://pastebin.com/iX05gYYB -the script for the background movement

Why does the movement lags so much? It's not from the laptop characteristics for sure (lenovo g510 i7 4700MQ, gpu radeon r7 265m). So this means it's either from the code although I see no reasons or smth else I'm doing wrong. Note how on the second video when I've reduced the gameSpeed 5 times still the platforms are shaky

UPDATE: It appeared that it's from the backgorund itself I removed the obstacles and found out that the backgound is the one that is shaky also left only the obstacles and they were fine so there's something wrong with the background. It's not the texture I changed the texture also. Tried to create a new project just to try the parallaxing and appeared that the same problem is there also ..

Comment
Add comment
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

2 Replies

  • Sort: 
avatar image
1

Answer by DMGregory · Dec 12, 2014 at 03:49 AM

Your platforms are moving using velocity. That means their position is being updated on FixedUpdate(), which is called ~50 times per second by default.

Your background is being repositioned on Update(), which is called once per rendered frame, which could be quite a lot more often if your framerate is high.

The difference between these two update rates can create judder like you're seeing.

For example, if you render at 30 fps with a physics step of 50 Hz, there are 5 physics updates for every 3 rendered frames; that means two thirds of your frames have 2 physics steps between them, but the odd frame out gets only one physics step (so the platforms seem to move less in that one frame compared to the others, making their movement look shaky).

One way to deal with it is to enable interpolation on your platform rigidbodies. What this does is offset the rendered transform in-between physics updates to give a smoother appearance. Interpolation: Extrapolate should predict correctly if your platforms are always moving at a constant velocity as shown here.

Switching both background & platforms to update the same way (either both in Update or both in FixedUpdate) will also fix any discrepancy between them, but might not be practical depending on their gameplay needs.

A more reliable fix is to move your camera instead of every co-moving object independently - fewer moving parts, fewer things can go wrong, and there's less data to interpolate. ;)

Comment
Add comment · Show 3 · 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 MapuHoB · Dec 12, 2014 at 04:28 AM 0
Share

Thanks for the time spent answering my question I will try it! :)

avatar image MapuHoB · Dec 12, 2014 at 04:36 AM 0
Share

Tried

One way to deal with it is to enable interpolation on your platform rigidbodies. What this does is offset the rendered transform in-between physics updates to give a smoother appearance. Interpolation: Extrapolate should predict correctly if your platforms are always moving at a constant velocity as shown here.

Switching both background & platforms to update the same way (either both in Update or both in FixedUpdate) will also fix any discrepancy between them, but might not be practical depending on their gameplay needs.

but still the shakyness is there I'd have tried the camera solution but I have some other logic in the game which doesn't allow me to do it

avatar image MapuHoB · Dec 12, 2014 at 11:26 AM 0
Share

I actually removed the obstacles and found out that the shakiness comes from the very background.. not from the obstacles

avatar image
0

Answer by blueLED · Dec 12, 2014 at 03:46 AM

How is the build performance though? I find everything is more fluid in the builds, from my experience. I thought this was normal because the editor is still running.

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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

26 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

Related Questions

Making a bubble level (not a game but work tool) 1 Answer

Moving object top to down 2 Answers

Movement Script 1 Answer

my game when built on ios is not smooth. 2 Answers

Help with Snake like movement algorithm. 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