- Email: bryan.duggan@dit.ie
- Twitter: @skooter500
- My website & other ways to contact me
- 2018-2019
- 2017-2018
- 2016-2017
- 2015-2016
- 2014-2015
- 2013-2014
- Week 5 - CA proposal & Git repo - 10%
- Week 13 - CA Submission & Demo - 40%
- Learn how to use coroutines
- Learn how to use colliders
Your task today is to make this:
Clone the repo for the course and make sure you start from the master branch. Create a branch for todays solution (call it lab4)
What is happening:
- The green tank is the player. The blue tanks are the "enemies"
- Enemies spawn at a rate of 1 enemy per second
- Enemies fall from the sky and land on the ground
- There are a maximum of 5 enemies at any time
- When the player hits an enemy it "explodes" (all the parts break apart)
- After 4 seconds, it sinks into the ground
- After seven seconds, it gets removed from the scene
- Slides on vectors & trigonometry
- Slides on quaternions
- Solution to last weeks lab is in scene2
- CubeMove example is in scene4. Example of dot product of vectors
- Vectors in Unity
- Quaternions in Unity
- Unity API Quick reference
- Use Colliders and Triggers
- Learn how to enable and disable game components
- User lerp & slerp
Your task today is to recreate this system from Infinite Forms:
Clone the repo for the course and make sure you start from the master branch. Create a branch for todays solution (call it lab3)
Open up the lab2 scene. There is the red tank following it's circular path (solution from last week). We are going to add a control orb to the red tank so that the player can enter the orb and take control of the red tank.
- Use the orb prefab and attach it at an appropriate position on the red tank
- Add the TankController script to the redtank and set it to be disabled
- Make a script called RotateMe that performs a local rotation and attach it to the orb so that the orb spins by itself
- Add a sphere collider to the orb and set the isTrigger flag to be true
- Add a script called OrbController to the orb and add methods for OnTriggerEnter and OnTriggerStay. OnTriggerEnter gets called on the script whenever the attached collider overlaps with another collider. OnTriggerStay gets called once per frame so long as the collider is still overlapping.
- In OnTriggerEnter you need to:
- Check you are colliding with the player
- If so, disable the FPS Controller on the player and enable the TankController script on the tank
- Disable the EnemyTankController on the Enemy Tank
- Disable the RotateMe script on the orb
- In OnTriggetStay you need to:
- Check you are colliding with the player
- Lerp the camera position and slerp the camera rotation
- Check for the space key, if pressed this frame:
- Disable the TankController on the tank
- Enable the EnemyTankController
- Enable the FPS controller
- Enable the RotateMe script
I may have left out some steps, but you can figure out the rest yourself
Use the Unity Quick Reference and the Unity online documentation to look up anything you need
- Build a simple agent with perception
- Develop computation thinking
- Use trigonometry
- Use vectors
- Use the Unity API
- Practice C#
Today you will be making this:
What is happening:
- The red tank has a script attached that has radius and numWaypoints fields that control the generation of waypoints in a circle around it. It draws sphere gizmos so you can see where the waypoints will be.
- The red tank will follow the waypoints starting at the 0th one and looping back when it reaches the last waypoint.
- The red tank prints the messages using the Unity GUI system to indicate:
- Whether the blue tank is in front or behind
- Whether the front tank is inside a 45 degree FOV
- Use the Unity reference to figure out what API's to call!
- Sign up for the class Facebook page
- Find the Unity tutorials
- Test your knowledge of Unity
- Create gameobjects in the scene view
- Create gameobjects from code
- Handle user input
- Use colliders
- Sign up for the class Facebook page
- Check out the Unity tutorial videos
Today you can test your knowledge of Unity by making this:
What's happening:
- The tank is made from two cubes. The turrent is parented to the body of the tank
- A material is used to color the tank blue
- A TankController script controlls tank movement which can use either a game controller or the keyboard
- The tank can fire bullets, which get removed from the scene after 5 seconds
- The camera will follow the tank in the style of a third person game
- The wall is made procedurally and physically simulated
- The player tank can crash into the wall and the bullets can damage the wall
- The bricks in the wall are randomly coloured
A few additional points
- If you have never used Unity before, start by watching a few of the tutorial videos
- See how far you can get with the lab today, but don't be too concerned if you can't finish it. We will make this project in the class next week together and you will discover the awesome power of Unity game engine