0

So I've been working on a project in Unity, and after writing this very simple code, I started wondering about how computers with faster and slower frame rates would generate slightly different speeds.

The code:

for (i = 0; i < distance ; i++) transform.Translate(speed*Time.deltaTime,0,0);

Mostly, I was wondering if in slower computers, the moving object wouldn't move as far, and if I took out the deltaTime multiplication, would the object appear to be moving slower in a slower computer than on one with a faster FPS count.

If so, how would I solve this problem, if it's a problem at all?

Steven
  • 166,672
  • 24
  • 332
  • 435
user3477016
  • 145
  • 1
  • 8

2 Answers2

0

If you use the Update() function (of a Monobehaviour object) then you shouldn't need to worry about the object not traveling as far.

joelg
  • 1,094
  • 9
  • 19
0

The whole point of using the Time.DeltaTime in the equation is to remove this fear. Remember that the Time.DeltaTime is not analogous to the FPS your machine can produce, with that you can produce animations/movements and in general anything time dependent and frame rate independent.

Nergon
  • 443
  • 2
  • 14