Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
4
Question by Vandash · Jun 07, 2011 at 09:56 PM · cameraphysicsjitterbestpracticesdamping

Jittery objects when camera attached to rigidbody

Hello,

My game setup is the following :

  • My character is a rigidbody, all movement code is done with AddForce, in FixedUpdate

  • There is a background that does not move behind character

  • The camera follows the character, the camera updates in LateUpdate

Now using this basic setup, I cannot find a single way to have all my objects not move with some jitter side effects.

I can add some rigidbody.interpolate ( http://unity3d.com/support/documentation/ScriptReference/Rigidbody-interpolation.html ) but the background is still jittery... I tried using many different smoothing methods for the camera, curently using a double damping, but it doesn't help. I tried moving around the camera update code, and it didn't help either. I also tried to fix my FPS to 60 (on PC it can run at 500FPS), and set my physics to 60fps as well, but still they are some jitters.

What is the best practice to have a smooth camera movement with no jitters when your character is controlled by physics ?

Thank you for your help!

Comment
Add comment · Show 7
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 Eli-Davis · Jun 07, 2011 at 10:30 PM 0
Share

Have you tryed a smooth follow camera script that unity comes with?

avatar image Vandash · Jun 08, 2011 at 07:47 AM 0
Share

Yes, I tried SmoothFollow2D (my camera orientation doesn't change), and it doesn't work.

avatar image Vandash · Jun 08, 2011 at 07:51 AM 0
Share

You can see the jittering effect in the latest online build : http://light-and-shadows.net/Unity/Chameleon/

avatar image GlitchComplex · Jun 22, 2011 at 07:04 PM 0
Share

Heya, any luck on solving this?

I'm having exactly the same problem. The rigidbody is set to interpolate, so its transform.position component should be silky smooth. I discovered however that it's not! Just plain old printing its position to the log window shows many times where it has exactly the same value for 2 whole frames, no matter which combination of Updates you try.

I'll be trying manual interpolation next, hope that works out.

avatar image Vandash · Jun 22, 2011 at 10:01 PM 0
Share

I switched to fixed framerate, it's far from perfect, but it's better.

avatar image octav88 Vandash · Oct 02, 2019 at 07:35 PM 0
Share

Your solutions to change to a fixed framerate helps a lot. $$anonymous$$aybe it's just a hot fix but works really good. Thank you, even if this helps me 8 years later:))

Show more comments

6 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by blade_sk · Mar 20, 2019 at 11:57 AM

You're probably looking for this https://docs.unity3d.com/ScriptReference/Rigidbody-interpolation.html rigidbody

Set interpolation of your RigidBody to "interpolate". It interpolates transforms for the missing frames if your FPS is greater than the update rate of physics.


2019-03-20-12-55-23.png (11.6 kB)
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 marcAKAmarc · Apr 20, 2019 at 01:30 PM 0
Share

This solved the issue for me. I had a camera following a transform nested under an obect with a rigidbody.

avatar image Beauque · Nov 22, 2020 at 06:48 PM 0
Share

Thanks! Solved the issue for me too

avatar image Pineapple_Squish · Dec 30, 2020 at 08:06 AM 0
Share

This is exactly what I have needed for a long time, moving my camera into FixedUpdate made the player smooth but the environment became jittery, which looks much worse. With this, both are perfectly smooth, thanks!

avatar image
4

Answer by maxrevilo · Jul 10, 2016 at 05:18 PM

For me the solution have been to set the Fixed Timestep to 1/FPS, for example if your desired frame rate is 60 FPS then your fixed timestep should be 1/60=0.0166665 or smaller, if you are worried by the performance then you should cap your FPS to 30 or 24 FPS.

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
0

Answer by cerealwrath · Jun 07, 2011 at 10:44 PM

There are several possible solutions for this issue.

  1. Attach the "Smooth Follow" script that comes in Standard Assets to your camera.

  2. Confirm that your character is not inside or touching the ground/terrain, even partially.

  3. Edit the Gravity variable and lower it to something around 8 or 10. (This will also reduce your fall speed.)

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 Vandash · Jun 08, 2011 at 07:49 AM 0
Share

I tried the SmoothFollow2D, and it doesn't work. $$anonymous$$y character is not touching anything I cannot change the gravity settings or the scale of the scene, and it should not be required, it's not moving very fast. I mean, the speed clearly impact the jittering, but even at low speed it's visible.

avatar image
0

Answer by wolfstien786 · Jul 28, 2012 at 02:32 PM

add a rigidbody component to your camera and move all your follow code into fixed update. Also make sure that other rigidbody codes are in fixed update. Hope this helps :o)

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 Lanthuas · Nov 13, 2018 at 03:49 PM 0
Share

This will make every other object that is not physically based jittery.

avatar image
0

Answer by Taphos · Feb 01, 2016 at 02:18 PM

Check my answer in this thread: http://forum.unity3d.com/threads/camera-following-rigidbody.171343/#post-2491001

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
  • 1
  • 2
  • ›

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

17 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

Related Questions

Physics + first person camera = jitter? 4 Answers

Move a camera with Rigidbody velocity without jitter 1 Answer

Jittery Movement - specific mechanics in mind 0 Answers

Jumpy object movement and camera movement 1 Answer

Camera jitter when using Lerp/Slerp 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