• 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 thenephalem · Dec 31, 2017 at 03:40 PM · unity 5rigidbodyfixedupdatecamera movementjitter

Camera jitters / lag behind when jumping or falling

I know that there have been numerous threads about t$$anonymous$$s topic but still i find it difficult to comprehend the whole situation. I update the rigidbody's velocity in the horizontal direction in FixedUpdate() and then I apply force (my own gravity) in the vertical direction also in the FixedUpdate() method. In the CameraController script I use the following lines to update the position of the camera.

toPos = currentView.position + (currentView.rotation * new Vector3(0f, 2f, -2.5f));
curPos = Vector3.Slerp(transform.position, toPos, smoothFactor * Time.deltaTime); And then I have in the LateUpdate()
transform.position = curPos;
transform.LookAt(currentView.transform, currentView.transform.up);

The result is quite smooth when running on a platform (no gravity) but the camera begins to jitter when I jump or the player is falling. I have spent too many hours on t$$anonymous$$s problem and I will be really grateful if someone is able to explain to me how to fix t$$anonymous$$s issue.

Best regards Your friendly neighbourhood noob

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

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by meat5000 · Jan 02, 2018 at 01:21 PM

It is usually inadvisable to directly modify velocity. It can make for some erratic behaviour. Jitter usually arises from differences of updates between FixedUpdate and Update. Timing of FixedUpdate is not really as Fixed as it may suggest and sometimes placing code in Update instead produces better results, creating better scaling of variables with respect to how the User views it from frame to frame.

Movement by direct Transform modification can also create some jittery results. A combination of the two could be asking for trouble. The results will be worsened at lower fps.


The reason why your character jitters in vertical w$$anonymous$$lst horizontal Velocity is being set is that Spamming a velocity component to 0f will cause that object to stop dead in that direction and then regain speed under the Physics Engines computational updates. T$$anonymous$$s is why a lot of people end up with Player-characters that float like clouds when jumping.


When setting Velocity, make sure to first read off the Current Velocity x,y,z values and use those as a base for your next calculation, adding or subtracting a scaled amount, instead of hard setting values. T$$anonymous$$s serves to add some (de)/(a)cceleration.

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 thenephalem · Jan 17, 2018 at 10:43 AM 0
Share
avatar image
4

Answer by thenephalem · Jan 02, 2018 at 12:03 PM

I have finally found the problem. It was that my rigidbody's Interpolate was set to Interpolate. I have changed it to None and all of the jitter/stutter when falling or jumping is now gone. I will definitely make further research on t$$anonymous$$s topic. If anybody has any idea why t$$anonymous$$s happens it would be wonderful. I make all of my physics in FixedUpdate.

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 DK_Programmer · Apr 01, 2019 at 11:36 PM 0
Share
avatar image ChunkyToads · Apr 04, 2020 at 12:35 AM 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

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

How can I avoid jitter of house? 0 Answers

Move a camera with Rigidbody velocity without jitter 1 Answer

Player movement not working with unity 5 1 Answer

Problem with jumping in fps game 1 Answer

How to drag object faster to the ground? 3 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