Office hours updated on Syllabus, Slides and Examples posted

I’ve updated the syllabus to include my, and the TAs, office hours.

I’ve also uploaded the slides from today’s class, along with the same Unity project I was poking at during the end of the class.  However, please be aware that this is not an example of what we expect for P1, as described in the comment at the start of the script:

PLEASE NOTE:  This is ONLY an example of how to use the CharController Update and OnControllerColliderHit methods for this example.

It is NOT meant to be an example of the kinds of avatar behavior you should aim for in P1.  The motion of the avatar is INTENTIONALLY bad, serving only to show that you can really just use whatever inputs you want to control the motion of the transforms.

We recommend that instead of using simple checks on the values of the last moveDirection that you create a simple state machine (storing the state in a private class variable) and base your motion computations in each state with what you want that state to feel like.   For the Mario example in the book, states might include STILL, MOVELEFT, MOVERIGHT,  JUMP, STARTFALL, ENDFALL, LANDED.  A state might be started based on key input (press space), time (first .1 seconds of fall after apex reached), or collision (hit ground, hit wall, hit platform from below).

Think through your states, and how you can tell when they start, and how you compute their motion during the state.

Remember that Update is called frequently, and you should use Time.deltaTime to see how long its been since the last update.  By computing your desired motions based on time (e.g., I want the character to move XXX far during the first 0.1 seconds) and then monitoring how long it’s been in a state (e.g., adding Time.deltaTime to a counter that you initialize when you enter a state), you can create motion that behaves correctly no matter how fast it runs.

Beyond these obvious issues with the example as a model for P1, the sample contains to graphical elements to reinforce any compelling metaphor, and has no sound effects or other polish to provide feedback or tie in with the desired feel.   It does, however, give you a starting point on using the CharacterController for the first project.

2 Responses to “Office hours updated on Syllabus, Slides and Examples posted”

  1. David Chi says:

    It may be helpful for those having trouble finding the uploaded files to know that they are linked on the “Schedule” page of the blog.

    • Blair MacIntyre says:

      Yes, I agree. I had sent mail to the class pointing this out, too, but it’s good to have this comment here.