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 OmegaFalcon · Sep 05, 2021 at 04:33 PM · rigidbody2dcamera followinterpolationjittering

Jittery object motion

When the camera is still, all moving objects look like they move smoothly, but when the player (and thus the camera) move, they all appear to have an extreme jitter in their movement. This is using cinemachine to follow the player.


From what I've read, this is due to the fact that the player itself is jittering, causing the camera to do so as well. So my question is why is my player jittering? It has a rigidbody with interpolation on, all physics are done in Fixed Update, player movement is done by setting it's velocity which is smoothdamped, Camera is updated with Smart Update (Late Update and Fixed Updated had worse results). Idk what else I could do??


Interestingly, this wasn't always a problem in my game, so I don't know why it all of a sudden is? I haven't made any changes to player movement or camera or anything.

Comment
Add comment · Show 3
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 AlbieMorrison · Sep 05, 2021 at 05:23 PM 0
Share

Is this game 3D or 2D, does it use materials for the objects, what is the ground made of, can you just give more information please? It is a little hard to help when there is not very much info available about the problem. How is your script doing the movement?

avatar image OmegaFalcon AlbieMorrison · Sep 05, 2021 at 05:41 PM 0
Share

The game is 2D and the movement is done by setting the rigidbody velocity like this:

 rb.velocity = Vector3.SmoothDamp(rb.velocity, targetVelocity, ref v_Velocity, smoothing);
avatar image AlbieMorrison OmegaFalcon · Sep 05, 2021 at 06:06 PM 0
Share

And is this in the FixedUpdate loop then? Maybe try not calling SmoothDamp every update period if that's what you're currently doing; maybe use a countdown and only SmoothDamp about once per 5 or 10 updates, while still keeping the target velocity updated every loop. Also make sure the SmoothDamp smoothing time is shorter than the time between when you call it and when you call the next one; it's possible that your SmoothDamps are interfering with one another and there are many trying to go to different end velocities (which would certainly make it jittery). Hope that helps.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ahsen35813 · Sep 05, 2021 at 07:33 PM

Before you read on, my answer is not a definite answer. I am only suggesting things that might work.

  1. Don't set the velocity of the player rigidbody, no matter how smoothly you apply the velocity. That's just a bad idea to do every frame. Instead, make use of the rigidbody's physics and apply force to move it.

  2. Instead of using cinemachine, try creating your own camera implementation, like this for example:

          //Looking around
             float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
             float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
     
             xRotation -= mouseY;
             xRotation = Mathf.Clamp(xRotation, -90, 90);
     
     
             cam.transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);   //Needs a gameObject cam which is your player's camera, which should be parented to the player
             gameObject.transform.Rotate(Vector3.up * mouseX);   //This script should be attatched to the player
     
    
    
    
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

133 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 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 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 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 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

Interpolation issue, some items not being interpolated correctly. 0 Answers

How to rotate an RigidBody2D object to an angle and get back to the previous position in the smooth way? 1 Answer

What kind of interpolation for my rigidbody 1 Answer

Camera following Rigidbody jitter every few seconds with background 0 Answers

Pixel games camera 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