Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 Rush3fan · Feb 04, 2012 at 05:56 PM · cameramovementjerky

Impossible to get perfectly smooth camera movement?

I can't believe this, but for some reason, I cant get truly smooth camera following in Unity. I don't know what I'm doing wrong.

So, to make things simple, this is basically how to reproduce what I am seeing.

1.Make a box collider-rigidbody with interpolation turned on and mass set to 1400.

2.Add a script to push the box in a direction:

 function Update () {
 rigidbody.AddForce(Vector3(4000,0,0));
 }

3.Now add a camera follow script. Something extremely simple like this:

 var target:Transform;
 function LateUpdate () {
 transform.position=Vector3.Lerp(transform.position,target.position,10*Time.deltaTime);
 }


What you will see is the box getting closer and further from the screen as if the delta time was coming in at random.

I have tried several different timing variables, each in a different update function, and it's always this jerky movement no matter what I try.

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 Rush3fan · Feb 05, 2012 at 12:03 AM

I guess I'm going with a different approach that doesn't use smoothing. It will still look good, but I'll have to add in my own Z factor that will just be a simple smooth velocity based float. The camera movement will look less natural, but oh well.. It's not like I really need it anyway.

Comment
Add comment · Show 4 · 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 Rush3fan · Mar 22, 2012 at 11:50 AM 2
Share

Ok, here's the deal. I finally figured out what I was supposed to be doing, but it's too late for now. Anyway, just in case someone else is having the same problem with lerp, you are actually supposed to use smooth damp. It's too bad no one knew that. =/ Smooth damping should be a very important part of game development. http://unity3d.com/support/documentation/ScriptReference/Vector3.SmoothDamp.html

avatar image POLYGAMe · Nov 04, 2013 at 11:23 AM 0
Share

Thanks for that, I was having issues with the "smooth follow" script myself. Problem solved :D

avatar image Moraleidahgo · Feb 02, 2014 at 02:08 PM 0
Share

Exactly what I needed. Thanks so much!

avatar image Ranger33 · Oct 12, 2016 at 04:35 AM 0
Share

This is a years old post now, but it totally solved my issue, thanks!

avatar image
0

Answer by Meltdown · Feb 04, 2012 at 06:06 PM

Firstly, you should be calling your physics related functions in FixedUpdate(), not Update().

I'd also suggest looking at the SmoothFollow camera script that comes with Unity, it works fine for me following rigidbodies with forces applied to it.

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 Rush3fan · Feb 04, 2012 at 06:13 PM 0
Share

Alright.. I changed the physics part to FixedUpdate. Still had nothing to do with making the camera more smooth.

avatar image Rush3fan · Feb 04, 2012 at 06:34 PM 0
Share

BTW: this is what the smooth follow script does:

transform.position -= currentRotation Vector3.forward distance;

That's not exactly smoothing out the camera's local Z.

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why is an object's movement jerky, when the camera is also moving by following a different rigidbody? 3 Answers

Very jerky camera movement with rigidbody 1 Answer

RTS Camera Rotation and Movement 0 Answers

movement disable when camera changes view 1 Answer

Move camera forward/backwards with mouse wheel 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