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
1
Question by ThiagoTejo · Dec 16, 2013 at 02:55 AM · lagsmoothtime.deltatime

Vector3 Lerp = SmoothDeltaTime vs deltaTime

Hello guys, I'm making a movement here, using Vector3.Lerp.

At the end of the line, I was always using Time.deltaTime, but recently, my editor player became very laggy, and the movement too. Then I tried using SmoothDeltaTime, and bam, the movement became way smoother! I didn't noticed any differences in my character speed or the heigh it jumps, so, what's the difference between these two? and why my editor is lagging and my build runs fine?

Also: These results happened in the editor screen only, whats even more strange, is that, when playing on a build, even with the normal Time.deltaTime, my game runs smooth, the problem is running in the editor, everything just lag as hell. ( I have no Debug.Log, i'm not selecting anything on the inspector and my console isn't showing anything, i don't know where the lags come from. The "stats" screen shows around 200fps(2ms). )

Thanks in advance.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by iwaldrop · Dec 16, 2013 at 04:35 AM

Read more info about it here. Basically, it does exactly what it says; it smooths the deltaTime.

Say the frame rate is humming along at 30 fps, then you experience a hiccup of a few frames at 15. DeltaTime will report a difference of 2 ms (30 fps = 2ms / frame, 15 fps = 4ms / frame), but smoothDeltaTime will report something closer to 2ms (but weighted by the frame loss). You can read more about smoothing here.

Comment
Add comment · Show 3 · 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 ThiagoTejo · Dec 16, 2013 at 04:54 AM 0
Share

Thanks, But would you reccomend using smoothDeltaTime over deltaTime? every character controller I see uses deltaTime. Why? smoothDeltaTime looks better. Can smoothDeltaTime give imprecise results as far as movement goes? Thanks.

avatar image iwaldrop · Dec 16, 2013 at 04:57 AM 0
Share

Well, yes, it will be more imprecise because it's not a true measure of the time between the current frame and the last. I've never used smoothDeltaTime, but I'm sure there are particular cases where it's proper to use.

Additionally, there's probably more work that needs to be done under the hood to generate the smoothDeltaTime (since smoothing needs to occur). Obviously Unity must track some of the data that's required, because it can never be certain when it might be used. But I'd bet that the calculations are actually performed in the getter, so (technically) using it will decrease your framerate that much more.

avatar image ThiagoTejo · Dec 16, 2013 at 05:34 AM 0
Share

Well, i tried mixing a few things in my code, in the end, i used Time.deltaTime for the general movement, because as I tought, smoothDetlaTime gave me some strange results sometimes, the character would go throught the wall sometimes, i guess its because it doesnt slow down properly when got closer to the wall due to the imprecise smooth. But it was useful when doing some other calculations, and the framerate haven't suffered as far as I can tell. From now on I will be using the old trial and error to see when its good to use one or another. Thanks for your awsers :)

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

17 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

Related Questions

Simple shooting script causing heavy lag 2 Answers

Web Player on Chrome lagging. Smooth in Fullscreen mode 0 Answers

Why is the paralaxing shaky? (video examples) 2 Answers

How do I rotate something smoothly? 2 Answers

Game Lags when 2 same Objects in scene 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