Lecture 103. Questions, questions, questions?

Basically, you asked yourself almost all the right questions needed to solve the problem of moving the player ship.

The next lessons will give you an answer, BUT you can always try to answer them by yourself, and with all the answers written down, you can proceed to write some code that follows those answers.

An example of how to proceed is this, I’ll take a couple of your questions:

  • Are we going to use Update or FixedUpdate?

  • Since FixedUpdate, as per Unity docs, is used by the physics engine, whereas Update is used by the graphical engine, the answer would be Update, since we’re dealing with a graphical update and not a physics one.

  • Are we going to use Time.deltaTime?

  • Since we’re going to use the Update method, and since this method is called every graphic frame update, the answer is yes.
    This stems from the fact that we’re trying to move something on screen with code, and this movement is based on a velocity, which is defined dimensionally as [space]/[time], so if we want to be consistent with the velocity dimension, and we change the position in the Update method, which is fired once every frame (i.e.: dimensionally is [frame]), to get the right amount of [space]/[frame] we need to multiply velocity * Time.deltaTime every Update call ( [space]/[time] * [time]/[frame]).

Same goes with all your other questions, write down the answers, and then write down the “gap fillers” among the various answers: the rest of the work will be just converting all these answers in code, but most of the work will be already done. :wink:

2 Likes