Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Kwergan · Dec 05, 2019 at 06:14 AM · physicsrigidbodycharacter movementcamera movementfirst person controller

How to prevent camera jitter when moving my Rigidbody first person controller

I have written a very simple Rigidbody first-person character controller. The controller is on a GameObject with a Rigidbody and Capsule Collider. A Camera is a child object of the Rigidbody object.

During Update:

  • The controller rotates the camera (vertical) with mouse input and rotates the GameObject (horizontal)

  • Gets the input from the keyboard (WASD) and stores it. (I know that inputs are updated on Update so this is where I should get input)

    During FixedUpdate:

  • Transform the input into a world space Vector3.

  • Apply acceleration to the Rigidbody in the direction of the transformed input.

    This controller works "fine" as far as moving the character around as expected and looking around etc. But when moving sideways at the same time as turning the camera horizontally, I notice this significant jittering in the motion of the camera.

    I am fairly certain this has to do with the asynchronous timing of Update vs FixedUpdate, as when I move the character during Update the problem does not occur. But I'm making a Rigidbody controller so I need to use FixedUpdate.

    Is there anything I can do to fix this?

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

4 Replies

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

Answer by lgarczyn · Dec 05, 2019 at 11:16 PM

Simply enable interpolation on the rigidbody. This will make it "lag" behind its real position, but will vastly improve jitter.

A kinematic rigidbody can have even better interpolation, but has to implement its own velocity and collision checks using raycasts.

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 pmargreff · Apr 14, 2020 at 02:27 PM 1
Share

I have no idea way, but for me the right result was archived when I did exactly the opposite, I changed "interpolated" to none and it worked.

avatar image fumetsuhito95 · Jul 25, 2020 at 11:12 PM 0
Share

Enabling interpolation worked magic for me.

$$anonymous$$y issue was the camera was following a ball. When I rotate around the ball while it is moving in slow motion there is no jitter. But when I leave slow motion and try to rotate around the ball while it is moving, jitter happens.

$$anonymous$$y thanks to you. I spent 3 hours trying to figure out how to solve the issue, and it was just a simple click.

avatar image
3

Answer by JakovHStudios · Aug 18, 2021 at 01:02 PM

Hi there @Kwergan , I know that this is a very late reply, but this worked for me:

If you move the rotation of the player through your camera script like this:

     player.rotation = bla bla //--in my case Quaternion.Euler(Quaternion.Euler(0, yRotation, 0);--

You need to change it so that you rotate the players Rigidbody, like this:

     player.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(0, yRotation, 0));

If you, or someone else read this, but i didn't really explain it well: Let me know!

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 poomwarning · Feb 28 at 03:44 AM 0
Share

well its work for me but not totally 100% smooth maybe i can put blur effect to make it smooth

avatar image
2

Answer by EagleDeveloper · Aug 07, 2020 at 10:52 AM

Hey @Kwergan ,

Sorry for the late Reply

Actually, I had the same problem, It actually is very simple.

Just Multiply your horizontal and vertical axis input with Time.fixedDeltaTime, just like this:

 x = Input.GetAxis("whatever") * Time.fixedDeltaTime;
 y = Input.GetAxis("whatever") * Time.fixedDeltaTime;
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 HernandoNJ · Jan 27, 2021 at 10:38 PM 0
Share

I was having an issue with characterController, and it was the fix. Thank you very much!

avatar image
0

Answer by ProfMonkey07 · Jul 25, 2020 at 11:14 PM

put the function moving the camera in fixedupdate or lateupdate maybe

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

229 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Gravity not working 1 Answer

Move a camera with Rigidbody velocity without jitter 1 Answer

Having trouble turning a Transform movement into a Rigidbody force. Code included 1 Answer

Character and Camera motion smooth in Editor, but jitters in Build 1 Answer

Rigidbodies get huge amount of velocity when clipping into other Rigidbodies 2 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