Unity 1,3 D Physic
Unity 1,3 D Physic
Summary: In this document, you will find the Module01 subject of the Unity Piscine.
Version: 1.00
Contents
I Instructions 2
II Foreword 3
1
Chapter I
Instructions
• If you have problems installing the tools needed for your project on the 42 comput-
ers, you can use a virtual machine. In this case, you will have to :
• The exercises have been ordered from easiest to most difficult. Under any circum-
stance you can submit or take into account an exercise if a previous one has failed.
• You should follow the submit procedure for all you exercises.
• You cannot leave any extra file on your repository except the ones explicitly specify
on you subject.
• Got a question? Ask your peer on the right. Otherwise, try your peer on the left.
• Everything you need can be found on the man or out there on Google.
• Read carefully the exercises: they may contain some features you should implement
that are explicitly mentioned on the subject.
2
Chapter II
Foreword
Today’s starring :
• Thomas - Lonely and slightly naive, Thomas likes to list his observations
about the world - and is absolutely fantastic at falling.
• Chris - Pessimistic, irritable and suspicious - Chris might not be the best
jumper, but he was doing just fine on his own.
• John - Rather proud of his agility and sportiness, John quite likes an audience
so decides to look after Thomas and Chris.
• Claire - Claire lacks confidence, she moves slowly and considers herself rubbish
at jumping. But then she discovers that she might be a superhero.
• Laura - Laura isn’t great at jumping, although she does have her own unique
ability - which, sadly, she’s too ashamed to tell anyone about. An ominous pixel
cloud has been following her around lately, and this worries the others.
• James - James had always been different. Not least because of his unique
disregard for Newtonian laws.
• Sarah - On a quest to find the fountain of knowledge and learn the truth
about her world, Sarah sees herself as rather more intelligent than the other "lesser"
quadrilaterals.
3
Chapter III
Exercise :
To start, run the demo so you know where you going today.
Create a scene Stage1 with:
• A Ground.
• A Camera.
At the start no character is active. You can activate and switch it with the Alpha1,
Alpha2 and Alpha3 keys.
Characters must help each other to pass the levels!
You can move the characters right and left with the keyboard (AD keys) and press
the space bar to jump.
4
Piscine Unity - Module01 3D physics, Tags, Layers and Scene
You must be able to reset the scene pressing a key, R and/or Backspace
Warning! You must only create ONE single script that will be applied
to all characters.
5
Chapter IV
Exercise :
• Claire, the blue square moves slower and jumps lower than the others.
• John, the yellow stick moves faster and jumps higher than the others.
• Thomas stands between both with an average speed and jump capacity.
You must always use the same script for all your characters
They must not be able to jump several times without falling on a surface, ground or
other character. No infinite jump or wall jump!
They must run through a first stage that forces them to cooperate to get to the exit.
6
Piscine Unity - Module01 3D physics, Tags, Layers and Scene
7
Chapter V
Exercise :
You must create a second Stage using Physics Layers in the level design:
• Characters can only use white or their color’s platforms. They go through the
others.
• You must link the stages. When the characters finish a stage, they have to move to
the next stage. If there are no more stage, they have to go back to the first stage.
8
Chapter VI
Exercise :
It’s about to get interesting! Create a Stage3 with teleporters and moving platforms.
You will choose to create fast and technical pathways, sadistic elevators, like in a good
old retro game where it will take 10 seconds to get the right elevator alignment.
The goal is to create a pleasant level to run through, not just a demonstration of
virtuosity.
9
Chapter VII
Exercise :
Now, create a Stage4 with switches that open doors. Even better, color switches that
open color doors.
Better yet! White switches take the color of the character that activates them and
open the matching color doors
Finally, switches that change the platform colors so the path the characters can use.
You’re clearly free to design this level as you like as long as you set buttons that work
as described above.
10
Chapter VIII
Exercise :
For the last Stage5, we’re going to set the difficulty a little higher so the player doesn’t
have the feeling they’re just walking around:
• Create color turrets that shoot regularly. The shot only hits the same color char-
acters.
• Create holes. The camera will not follow a character falling in a hole.
• If a character is hit by a turret shot, hits a trap or falls in a hole, the game is over.
You can code everything with yesterday’s and today’s lessons. Don’t
use any other system, especially with timed actions and coroutines to
manage the turrets’ shots. We’ll see about that later.
11
Chapter IX
Turn in your assignment in your Git repository as usual. Only the work inside your repos-
itory will be evaluated during the defense. Don’t hesitate to double check the names of
your folders and files to ensure they are correct.
You should not put all the files of a project on git, otherwise
the disk space occupied by the repository will be unnecessarily
increased. Here is how to configure Unity and GIT for an optimal
use.
• Make sure that Unity saves as many files as possible in text
form instead of binary.In Unity, go to Edit >Project Settings
> Editor. Under textttAsset Serialization, you have to choose
the Force Text Mode.
12