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 eddie987321 · Apr 22, 2012 at 01:41 AM · cameralerpslerpjitter

Camera jitter when using Lerp/Slerp

I know similar questions have been asked already but I've been through almost all of them and none of the solutions seem to work for me. Basically I have a camera that pans to a predefined location when the mouse button is clicked, which works fine minus the somewhat subtle jitter.

   static var cameraPosition : int;
 
 function Update () {
     if (cameraPosition == 1) {
         transform.position = Vector3.Slerp (transform.position, target.transform.position, Time.deltaTime);
         transform.rotation = Quaternion.Slerp (transform.rotation, target.transform.rotation, Time.deltaTime);
     }
 }

I've tried used function FixedUpdate and replacing Time.deltaTime with 1 - Mathf.Exp(-k * Time.deltaTime) but to no avail. The jitter exists for both the rotation and position. Any ideas?

Comment
Add comment · Show 5
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 eddie987321 · Apr 22, 2012 at 03:00 AM 0
Share

I tried that too. Giving it a value such as 0.05 still results in jitter.

avatar image AchillesWF · Apr 22, 2012 at 03:06 AM 0
Share

That's because even with a constant you are still constantly moving, even if just a tiny bit because in your system (that you've shown anyway) you never seem to accept the fact that you have arrived and cease Slerping.

avatar image eddie987321 · Apr 22, 2012 at 03:20 AM 0
Share

Sorry for not specifying earlier. The jitter is at its worst during the peak speed of the camera pan, namely when it's about halfway to the target location. Just in case though, I tried your idea and stopped the camera from Slerping once it's distance to the target was less than 0.01

avatar image eddie987321 · Apr 22, 2012 at 03:21 AM 0
Share

Oh wow. I tried it with the distance value of 0.1 and the camera Slerps so smoothly now. Don't really understand how that works but I'm glad it works nonetheless. Thanks a bunch.

avatar image eddie987321 · Apr 22, 2012 at 03:29 AM 0
Share

Actually...I take that back. It seems to work more smoothly but there is still a noticeable jitter.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by AchillesWF · Apr 22, 2012 at 02:11 AM

I think the jitter comes from the fact that you are always sending it essentially random (based on frame time) values to the Slerp() functions, which expect between 0 - 1 indicating the proper interpolation between the 2 extremes, not a time value.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Camera Lerp Jitter 0 Answers

3D menu camera rotation issue. 0 Answers

Lerping orthographic camera size jitters 1 Answer

Transition current camera rotation to 0,0,0 1 Answer

Movement Smoothing Script not Working 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