Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by idontwannawork · Jun 22, 2017 at 06:02 AM · programmingdeltatimedelta

What exactly time.deltaTime is?

My Speicific question in Picture: http://pingpistorage.blogspot.kr/2017/06/about-timedeltatime.html

What I know about 'time.deltaTime' is that it used to workout with the frames and end them at exactly same time. No matter how difference in performance among the computers Example: Computer A 60fps Computer B 30fps

Here are my questions

  1. what is 'Time.deltaTime' and how it calculated mathematically, but I think this is more like should discover how this API work.

  2. What makes run the computers in same time.

  3. What is concept of Delta.

  4. Are Delta and DeltaTime related?

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
16

Answer by jeango · Jun 23, 2017 at 04:03 AM

  • Time.deltaTime is the amount of seconds it took for the engine to process the previous frame. It's calculation is rather simple: it uses the system's internal clock to compare the system time when the engine started processing the previous frame to the system time when the engine started processing the current frame. Every motherboard has a "system clock" which is responsible to keep track of time. Operating systems have access to that system clock and provide API's to read that clock. And Unity gets the time from that API and that's how things are synchronized.

  • Think of a game as a movie, which is essentially a sequence of images. The difference is that a movie is rendered at a fixed rate of 24 images per second, while a game doesn't have a fixed frame rate.

In a movie, if a car travels at 1 meter per second, each image will make it move by 1/24 meter, and after 24 images (1 second) the car will have traveled exactly 1 meter. It's easy because we know that each frame takes exactly 1/24 second.

In a game, we have to do the same thing, except the frame rate varies. Some frames can take 1/60 second, some others can take 1/10 second. We can't use a fixed ratio. Instead of a fixed number we have to use Time.deltaTime. Each frame, the car will move a distance proportional to the time of the frame. After roughly 1 second, the car will have traveled roughly 1 meter

  • Delta is the mathematical symbol for a finite difference. Its use is very common in english when talking about something that changed over time.

  • deltaTime is a difference of time, so it's a Delta

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 idontwannawork · Jun 25, 2017 at 02:38 AM 0
Share

Thank you for your answering my question.

avatar image idontwannawork · Jun 25, 2017 at 03:46 AM 0
Share

I only get from you that there are two things (Time System from Computer $$anonymous$$otherBoard and maybe window OS) And (API in unity Engine). So Unity API refers to System time.

And I appreciate your examples.

http://pingpistorage.blogspot.kr/2017/06/i-will-try-to-compare-this-thing-in.html

avatar image
5

Answer by Priyanka-Rajwanshi · Jan 11, 2020 at 05:55 PM

First, Time.deltaTime is the completion time in seconds since the last frame. Time.DeltaTime = 1/fps Therefore, when fps is 60, Time.deltaTime is = 0.0166666 seconds.

Second, Lets take an example:

 transform.Translate(Time.deltaTime , 0 , 0);

Lets say the fps is 60. Time for each frame is 0.016666666. The distance moved by object in 1 second is 1 unit(0.0166666*60 frames)

If the fps is 30, i.e. 30 frames in one second, time for each frame is 0.03333. The distance moved by object in 1 second is 1 unit(0.03333*30 frames) Therefore using deltaTime, make the object move through the same distance on different devices.

Third, Delta mathematically means difference.

Fourth, deltaTime is the difference of time of this frame and the previous frame. Thus is mathematically a delta.

For more information, go through the following link: http://codesaying.com/time-deltatime-in-unity3d/

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

Answer by hexagonius · Jun 22, 2017 at 06:49 AM

Delta basically means difference. DeltaTime is the difference in time that it took from the time it took the second previous frame to finish to the time the previous frame finished. Since you mustn't know how long your current frame will be, the best bet is the last one.
This means, no matter how fast or slow a machine is, DeltaTime is smaller or larger accordingly, basically adjusting calculations always to / per second. The more genes the smaller deltatime and therefore the steps in calculation it's used in. Always adjusting to an equal experience.

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 Bunny83 · Jun 22, 2017 at 09:09 AM 2
Share

Right, therefore deltaTime is not "calculated" but "measured". The mathematical relation between deltaTime and fps is:

 fps = 1 / deltaTime

and the reverse:

 deltaTime = 1 / fps

though as i mentioned deltaTime is not calculated but measured.

avatar image idontwannawork · Jun 25, 2017 at 02:38 AM 0
Share

Thank you for your answering my question.

avatar image
4

Answer by LittleDreamerGames · Jun 22, 2017 at 02:37 PM

How low level do you want to know? Every computer runs at some frequency. There's a clock register (address in memory that stores the current tick) that is converted internally by the API that Unity uses. Unity then does its own time management and stores that into its Time class.

Basically, deltaTime is the time in seconds that has passed since the last frame. So say you want an object to move 100 pixels in 1 second. You can determine the distance by multiplying 100 by the deltaTime. The cool part is that if exactly 1 second passed, then 100 x 1 = 100. Let's say the last frame took 0.5 seconds, then 100 x 0.5 is 50. If two frames go by, 0.5 seconds each, then the time that has passed is 1 second, because 0.5 + 0.5 = 1. And the distance for those two frames is 100 because 50 + 50 = 100.

Delta means the measurement of some value relative to the last measurement taken. In my example above with the two frames equaling 1 second, the first delta was 0.5, and so was the second. So with this, the unit of measurement of the delta, is time.

Edited: Maybe this will clarify what the difference between Computer A and Computer B is. Computer B is obviously slower than Computer A. That means Computer A can process a lot more data in the same amount of time as Computer B. HOWEVER, internally, none of this effects the clock keeping track of time. One second is still one second, no matter how fast or how slow the computer is. Because of this, we can take snapshots of the time that has passed between program cycles (delta time). From there it's just a matter of using the whole distance = rate * time formula. By using this formula it doesn't matter if 60 frames passed, or 600 frames, an object traveling at a rate of 100 pixels per second, will still reach 100 pixels in one second.

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 Jwizard93 · Jun 22, 2017 at 08:48 PM 0
Share

Just as an interesting bit of history:

Some games of old used the unfiltered speed of the processing equipment to deter$$anonymous$$e the speed of objects in the game as they move about the screen, or the speed of the camera moving through the game world.

Perhaps they thought there was no way processing speed could get any faster. Or maybe they didn't care if their game was forever tied to the system it was developed for.

The result is that one can run some old games on modern emulators and find them comical or even unplayable in the speed of the action.

avatar image hexagonius Jwizard93 · Oct 18, 2018 at 06:24 PM 0
Share

yeah, I remember that one com the early days of Counter Strike. people with faster computers were more reliably shooting at the weapons fire rate while slower computers didn't.

avatar image idontwannawork · Jun 25, 2017 at 02:39 AM 0
Share

Thank you for your answering my question.

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

78 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

Related Questions

When i press a key i want my cube's position to change by 1. How can i do it? 1 Answer

Invoking error handler due to uncaught exception: abort(-1) at jsStackTrace (NAME.wasm.framework.unityweb:1559:13) 0 Answers

adding two integers together once every half second,adding two integers together with delay? 1 Answer

Object with rigidbody2D doesn't move when it's supposed to, 0 Answers

1. How many game objects(like Shpere) we can create per frame in unity? 0 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