Skip to content

No Class Today.

I will be posting a project tonight.  It will involve integrating character models and animation with our steering behaviors.  No more spheres moving around.  We will have real art and animation. This project will involve learning more about unity than AI but it will help everyone when we move on to our next topic.  Plus it makes for slicker demos!

Help Is Here For Assignments! Register as a user on this blog!

The one thing that I am looking for is that you guys try to do the work.  I have designed the assignments so that if you do the reading and just open up the project you should see that the example code in the book and the code I provided are similar.  In fact they are almost the same with a line or two missing.  If you guys do the reading you should be able to find the missing code in the book!  However,  because the project is in a new programming environment it can be hard to see past all the complexity of Unity and C#.

So what I want to do is have everyone post their questions to this blog.  If you have a question about an assignment, including compilation errors and anything else that is preventing you from getting the assignment done, please post it in the comments section of the assignment.  That way when I respond everyone benefits.  Not only that you guys can and should ask each other for help and this blog is a good place to do it.   That way I can tell if I am going too fast in class or if we need to go over something again.

So please register as a user on this blog so you can leave comments.

Lecture 4 Follow Up

As a result of half of the class not handing in the assignment I am not going assign another project for next week.  Instead I am going to have you guys re-read the sections that most people had trouble with.

re-read section 3.2.2 Wandering pp 53-55 Some people had trouble here.
re-read section 3.3.5 Align. pp 62-66 – Nobody implemented align correctly.
re-read section 3.3.12 Path Following pp 76-82 Going to cover this next week.

Lecture 4 Cancelled.

I have cancelled lecture 4 due to the weather (Again!!!!).  I am going to post an assignment later tonight or even tomorrow… I want to see how people are handling Lecture3’s assignment before I assign anything else…. I need to know how well you guys know the material.  I don’t  want to go too fast.

Lecture 3 – Class Cancelled. Project Is Now Assignment.

Here is the starter project for the assignment.  The source file you need to change is AIBehavior.cs.  To change a specific actor’s behavior:

  1. select that actor in the heirarchy view
  2. go to the Actor script
  3. change  ”Desired Behavior” to either “Seek”, “Flee”, “Arrive”, “Wander” or “Align”
  4. if you have “Wander” make sure “Face Where You Are Going” is unchecked.

The minimum behaviors you have to implement are Seek, Flee and Arrive.  Wander and Align are both extra credit.

The Assignment is due prior to class next week(By 6PM 2/16/10). Collaboration is allowed…. However you need to indicate who you collaborated with.  Stating that in the assignment submission email is fine.

Ways to submit:

  • zip up the project directory and email it to me  (That is Lecture3Incomplete/ folder)
  • if you only modified AIBehavior.cs you can zip that and email it to me… I will put it in my own project and run it.

Hints:

Look at the textbook and the code that is from the textbook’s website!!!!

The most you have to change/add per behavior is a 2-4 lines. If you find yourself typing more than 5 lines for a behavior you are doing more than is necessary.  However I won’t penalize you for have more lines than necessary.  If the behavior works and doesn’t crash a lot you will get full credit.

Remember that the Function GetOrientationAsVector(float) is a static function. That mean you just put the Class Name in front of it not an instance(a variable you created). So to call it you type:

Vector3 orientationVector = Actor.GetOrientationAsVector(currentActorOrientation);

“Actor” in this case acts like the math classes in unity…. Mathf.Sin() calls the Sine function on the Mathf class without instantiating a Math class. Actor is the same way in this case.

Lecture 2 Files

Here are the files from lecture 2. Just unzip the files and open Assets/Scene.unity.

Feb 2 Class Goals

Stuff to give you guys… a little sandbox world asset bundle.  So we can all start with the same environment.

To understand:

For Math:

  • Vectors
  • Matrices/Transforms
  • Splines

For Programming:

  • Sending Messages
  • Triggers
  • Collision Handling
  • Using Character Controllers
  • Programmatically Moving Character Controllers
  • Making a character follow a spline/path (Just a hacky demo… not real path following.. that is a later lecture)
  • Making Prefabs/Instantiating Prefabs
  • Destroying objects
  • Creating Asset Bundles

Putting it all together…  Walking into a trigger which spawns randomly spawned zombies which head in your direction and destroy themselves when they touch you.

Site Link For Math Quick Reference

The site I am linking to is the FAQ for comp.graphics.algorithms newsgroup.  This is just a link to the “Geometry Basics” part of the site.

http://www.cgafaq.info/wiki/Geometry_basics

Please look at the dot product and 2D point rotation pages. On the dot product page pay special attention to the section under the diagrams that starts with “We draw the following conclusions:”.   On the 2D point rotation page realize that we are using row vectors for the purpose of the example they give(I am pretty sure about this but not positive).

Don’t worry about constructing matrices and multiplying vectors with them.  Unity does all of that in their Transform class.

Good Beginner Lecture On Matrices

MIT has many lectures online as part of their Open Courseware.  My favorite one is their Linear Algebra class taught by a great professor Gilbert Strang.  His first lecture is a great introduction to matrices which we will be talking about in our next lecture.

Here is a link to the first lecture which is the one you guys should look at and if you are interested the rest of the course lectures are very good.

Pay attention to what he calls the “Column Picture.”  This is the way we think of Matrices and Transforms in 3D graphics. I think he starts talking about this around 20 minutes into the lecture.

http://ocw.mit.edu/OcwWeb/Mathematics/18-06Spring-2005/VideoLectures/detail/lecture01.htm

Beginner Unity Tutorials

Unity Editor Tutorials.

Scripting Tutorials.