How does this increase the speed every second? Is it due to Time.DeltaTime part?

Hi all, so in Driving Forward video of the Mobile Unity C# course. The challenge is to “Increase the speed variable by x amount every second”. I understand that we’re adding the speed gain into the original speed variable. But we’re adding it every “Fixed Update” frame. Wouldn’t that gain speed every fixed update, and not every second? Is a fixed update equal to 1 second? Or does this split my gain variable so that it equals the total gain once it hits 1 second?

Yes, correct. You you do something like
transform.position = Vector3.forward * speed * Time.fixedDeltaTime;

depending on how you’re doing your controller. The speed * Time.fixedDeltaTime does the work of moving at the speed every second.

If I remember right, FixedUpdate is called 40 times a second, but it can be changed in the project settings.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms