Week 3 - Animations, shaders and lighting
This week's work revolved around Exercise 2 as
outlined in the following image:
A couple of group members were behind at this point,
which meant a catch-up session was needed so that all members could participate
in the exercise. This catch-up session involved taking a set of pre-defined
assets and animations that could be slotted together to learn how Unity's
animation system works and how the state machine animator is used.
This started with the basics of animation such as
adding a controller to the object to be animated then adding simple animations
to the object based on basic conditions, such as whether or not the object is
moving. This was achieved by taking the speed of the object from a scale of -1
to 1 and assigning a walking forwards or backwards animation based on the
value. A value greater than 0.1 would be a forward walking animation, and a
value of less than -0.1 would be a backwards walking animation. The same was
achieved with a left or right rotating animation.
The follow-up to this was simply to add further
functionality to our character, such as the ability to jump and slide, as
well as animations for idle and running. The running key was mapped to left
shift, with jump and slide mapped to space and "v" respectively. One
thing that turned out to be pretty tricky at this stage was having to think
about and implement all of the logic involved in character movement. Some
examples of this are:
- How to only allow the character to slide while
running, and not in the idle or walking states
- How to make it so that the character does not
jump whilst already in the air
- How to stop animation when the character hits
a solid object
Once some time was spent working towards fixing these
logical movement points, more and more animations were able to be added, as
well as some basic scenery and traps that the character has to avoid. The final
outcome was a rather complex single-layer state machine as follows:
Once animation was done to a reasonable level, the
team moved on to adding special lighting and effects to the scene, which proved
to be somewhat of an issue. The main issue was that light just simple was not
working within the scene and it took the team a long time to realise that it
was because of the shaders that were built in to the assets that had been
imported, both with the character and with the outlining walls to our
"dungeon" scene. Once this had been figured out and the shaders
switched out for (for now) default unity shaders, it was easy to add light to
the scene as the following image shows:
This concluded the work of this group for this week.
Comments
Post a Comment