Thrust Variable (I forgot how to do Time.Deltatime

[SerializeField] float Thrust = 1;

Easy fix. Go back and do an earlier lecture to go over how to do it. Alternatively, a quick google search will also help.

When you use the variable in rb.AddRelativeForce, you want to take your thrust and multiply it by Time.deltaTime.

For example:

void Update() {
    rb.AddRelativeForce(0, Thrust * Time.deltaTime, 0);
}

One piece of advice however is don’t capitalize the first letter in the name of your variable. Although it isn’t necessary, the general consensus on the naming of variables is to use “camelCasing”, where the first letter is lowercase and the next words are capitalized. When you capitalize the first letter, you are using “PascalCasing”. Pascal Casing is generally reserved for “Methods” or “Functions”. Again, this is just nitpicking and doesn’t affect how the code runs.

Privacy & Terms