Hello, I can understand that the Time.deltaTime is very important when moving something at a constant speed (in this case, a rigidbody), but I can’t get it to work.
With this code it work’s good, but I guess it won’t work well on slower computers.
public int speed = 100;
void FixedUpdate () {
rigidbody.AddForce(transform.forward * speed);
}
But with the Time.deltaTime it only moves very very slowly (barely noticeable) and it doesn’t work to set a higher speed value. (It doesn’t show any error’s in the Console)
public int speed = 100;
void FixedUpdate () {
rigidbody.AddForce(transform.forward * speed * Time.deltaTime);
}
Can you understand what the error is here? ![]()
Thanks, Andreas ![]()
actually I believe your first code example is totally, perfectly correct. you're simply adding a fixed amount of force units (like "18" or something) at regular times. That's fine and you have no problems. it will work identically on all computers because it is indeed running at a fixed rate. regarding "Time.deltaTime" you basically use that when moving something .. so, you are moving it "by hand" using .Translate or just changing the .position You could take a simple cube and experiment with moving it by Time.deltaTime, each Update() .. you'll see it moves smoothly.
– Fattie