Disclaimer : This article concerns Computer Graphics which I follow with my M2 "Virtual and Augmented Reality" at IPParis.
Objectives
It's a one-month project, we have to create a 3D Platformer wit those specifications :
- Level design : Platform - Trap - "Puzzle" - Collectibles
- Character : 3D model with 4 animation - Scripts of movement and third camera
- UI : Timer - Collectible counter - End message
- Sound : Background music
- Gameplay : 1 minute minimum
- Deliverables : Unity project - Build - Gameplay video
| OnCollider in blue // OnTrigger in green |
Kinematic means that no force are applied on it.
My work
In this lab we will go faster on some points because we've seen it in the roll-a-ball lab. I also invited you to open the github project (in particular scripts folder to see what I'm talking about.
Level design
We discover how to create an object. I create a scene with a floor and also add some platforms : I put all this in an empty object "Very easy level".
We also discover how physics work on an object (bounce and friction). The object must have a rigid body then you applied a physic material on it. In my case I just put a bouncing ball and bouncy platforms.
We create a player with 2 given scripts (3D camera and control). Don't forget to organize your Assets a folder for the Scenes, a folder for scripts, a folder for animation...
| Left : CheckPoint // Right : Deadzone (player might not be here) |
As you see on the second function we use "tag": we want to teleport only the player and not all objects which touch it. Tags are just below the name of an object :
Two methods exist to create a moving platform, both use animation :
- Change position of it. Issue : the platform move without the player
- Add a small script (AddConstantVelocity) which use forces moving (again you need a rigidbody) : put a heavy weight to avoid influence of player's forces and add constraints to it.
I use our blender rocket to create collectibles : I add a trigger collider, a tag and some particles : it's my prefab : I put some of them everywhere.
We have done a good job on the Level design, let's work on the UI.
User Interface + Sound
To work properly on your UI, double-click on Canvas and press 2D. Add all the text you need must appear here, disable and enable it
Apparition and disappearance, will be manage in scripts. It's interesting to have animation on texts to avoid abrupt appearance :
To put a background sound, just add an audio source object but if you want to make it appeared as an event you could use IEnumerator. In this example I make a small sound when the player catches a collectible :
| We also see how collectible's script work - PlayerController |
EndGame
Before the last part I put an invisible wall StartEnd to start my last script : it displays some text but also start the animation of the plane :
Then you have some times to collect last rockets and jump on the plane: it changes the main camera, deactivate the player and stops the time. In this part I didn't treat the case when you don't go on the plane.
Animation
On mixamo or by yourself you need to create animation : it's important for them to be "in-place" :
Once you have this you create an animator for your character. Put some states and conditional transition in it.
Last part concern the script here is mine for the two figures we see above :
| Movement part. Conditions : (Float) Speed + (Float) direction |
| Jumping part. Conditions : (Trigger) isJumping |
Gameplay trailer
All we see in this lab is available on my GitHub.


