FINAL PROJECT

The game

You will try to reproduce a game from the Steam store called Coin Pusher Casino :

../_images/coin.png

Gameplay

Coin Pusher Casino is a virtual arcade game where you drop coins onto a moving platform, aiming to push others over the edge and into the tray at the bottom. Coins that fall in the tray are automatically collected and added to your total.

  • Player drop coins, one at a time, by clicking on the back wall

  • The click location determines where the coin is dropped from

  • Platforms are already filled with coins

  • Some platforms slowly slides back and forth

  • When your coin lands, it might:

    • Push other coins closer

    • Trigger a chain reaction

    • Knock coins or special prizes into the tray below

  • Coins that drop into the tray count as your winnings

In the game interface, the bottom tray isn’t really visible. So consider that any coin that falls all the way down is automatically collected.

Basic assets

Project setup

  • Create a new folder called Project

  • Insite this folder, create a new scene called POC and open it

  • Create a subfolder named Tokens in the Project folder

At the beginning, we will only use two elements:

  • The coins, which represents the falling coins and the coins already on the platform

  • The casino chips, which are larger, colored and often stacked in columns

Chips look like classic casino chips, with values like $5 or $10 written on them. When they fall into the tray, their value is added to the player’s total. Coins, on the other hand, are just for pushing — they don’t award any money.

  • Download the following asset:

  • Drag and drop these files into the Tokens folder

Coins

  • Create a new material for the coin

    • Select a warm copper color

    • Increase its metallic property to give a metallic aspect

  • Create the Coin object

    • Drag and drop the obj file into the scene

    • Drag and drop the material into the object

    • Add a rigibody component

      • Set mass (10g)

      • Activate gravity

    • Add a mesh collider

Avertissement

Sometimes the mesh collider fails to detect the inner mesh and remains « empty »

../_images/empty1.png
  • In the Tokens folder, click on the coin asset to view its internal elements:

../_images/mesh.png
  • Drag and drop the default mesh into the missing mesh of the mesh collider

  • Enable the Convex option

  • Create the prefab

    • Drag and drop the object into the Tokens folder

Chips

Same procedure, except for the material where you have to assign the downloaded texture.

  • Set mass to 20g

../_images/folder.png ../_images/tokens.png

Pusher

The pusher has a specific behavior:

  • It follows a predefined path

  • It can push coins

  • Its movement is not affected by objects it collides with

By default, a Rigidbody reacts to forces and other objects in the scene. Fortunately, Unity provides an option called Kinematic which allows an object to behave like a pusher:

  • Ignores physics forces – The object won’t be affected by gravity or collisions

  • Doesn’t move automatically – It won’t react to physics; you must move it via a script

  • Still detects collisions – It can trigger collision events, but won’t be pushed or bounce

Here are the dimensions of the pusher:

../_images/pusher.png

Scene setup

  • Create a floor using a cube scaled to 5×0.6×10

    • Apply a solid color to this floor

  • Create the pusher using a cube scaled 5x0.6x10

    • Apply a solid color to this floor

    • Move the pusher so that it rests on the floor

    • Move the pusher back

    • Add a Rigidbody

      • Enable its Kinematic flag

    ../_images/floorpusher.png
  • Build two walls on the left and right to prevent tokens from falling off the sides:

Animate

  • Create a script and attach it to the pusher

  • Look at the movement of the pusher, its speed is not constant

    • The pusher’s speed decreases at the extremities of its movement

    • Thus, we propose to animate the pusher using this formula:

\[z(t) = z_0 + K.sin(\omega.t) ~~~~ // ~~x(t) ~~also ~~possible\]

Thus:

  • As the pusher moves back and forth over a distance of 1, we know that \(K = 1\)

  • The period lasts 5 seconds, so you can deduce the value of \(\omega\)

  • The last step is to determine \(z_0\) from the environment you’ve built

../_images/sin.gif

Avertissement

In order to make the physics engine work correctly:

  • Moving platform must have its Kinematic enabled

  • To change its position, DO NOT MODIFY its location using transfrom.position but instead apply update directly on the Rigidbody using: rb.MovePosition(…)

  • Do not use Update() in your script, but FixedUpdate() instead

Vector3 pos = transform.position;
pos.z = ...
rb.MovePosition(pos);  // command the rigidbody

Proof of concept

Before spending hours on production, we’ll quickly set up a POC. If it’s too complex for Unity’s physics engine, there’s no point in going further. Everything is ready — create multiple coins and chips flying through the air. This way, they’ll fall like a waterfall, and we’ll be able to see if that works correctly!

../_images/test1.png

Here is our result:

../_images/firsttry.gif

For a first attempt, it’s really not bad at all!

  • The coins and chips fall as expected

  • They bounce realistically off the floor

  • The pusher moves the tokens forward

But there are still a few annoying issues:

  • Some tokens keep shaking and sliding around

  • Some tokens partially sink into the floor

Let’s be honest: you can tweak Rigidbody settings all you want, but it won’t fix the real issue. We’re overloading the physics engine with too many coins, all in constant contact. This is pretty much a nightmare scenario for physics, way more complex than simulating a car driving on a road.

But the 3D engine almost manages to handle it — it just seems to lack precision. As a reminder, physics is simulated by discretizing time into fixed steps, which are set to 0.05 second by default. That timestep is still too large for our fast-falling, bouncing coins. Let’s reduce it by a factor of 10 and see how the engine reacts:

  • Navigate to: Menu > Edit > Project Settings > Time

../_images/time.png
  • Set Timestep to 0.002

  • Enter Play mode

../_images/gogo.gif

Wow, great, it works like a charm!

Chips

Chip Value

  • Open Word and create a blank document

  • Type the number: 10

  • Pick a font you like

  • Set font color to yellow

    ../_images/10.png
  • Select your text

  • Navigate to Home > Font > Text Effects logo (Accueil > Police > Effet de texte)

    • Select a black outline color and adjust its thickness

    ../_images/10bis.png
  • Zoom your text to increase its size on screen (bigger is better)

  • Run capture.exe and take a snapshoot of the number

  • Run mspaint.exe and open the texture file textchip.png

  • Paste (CTRL-V)

    • Click on the selection menu

    • Select Transparency to remove the white background around the number

    • Adjust its size to fit the interior of the chip

    • When placement is correct, press CTRL-C to copy the new size

    • Paste CTRL-C and move the number on the second face

../_images/10.gif

Chip Color

  • Run mspaint.exe and open the texture file textchip.png

  • Select a color

  • Select the Fill Tool

  • Change the color of the texture

  • Save this texture as 10.png

../_images/10coul.gif

Material V2

  • In unity create a material named mat10

  • Create a chip in the 3D scene and and assign this material to it

  • Copy the texture 10.png in the tokens folder

  • Assign this texture to the material

    ../_images/10tex.png
  • Download the following asset:

  • Assign this reflection map to the material’s metallic input

    • The white cells on the chip’s border will become reflective:

      ../_images/reflex.gif
    • Reflection map without texture:

      ../_images/reflex2.gif
  • Assign the normal map to the material’s normal map input

    • The normal map makes the chip’s center look slightly lower than the outer border

      ../_images/reflex3.gif

Final phase

Create 4 prefabs with different values and colors. Do not forget to set up each collider and each rigidbody.

../_images/chips.png

Coins

Normal map

Geometrically speaking, a coin is essentially a flat surface. To model fine details accurately, we would need to add million of vertices. In such a case, it’s more efficient to model a flat surface and apply a normal map to add details.

Height map to normal map

A height map is a grayscale image where the brightness of each pixel represents elevation. White regions correspond to mountain, whereas black regions represent plains. For example, let’s have a look at this image:

../_images/star5.png

According to color convention, this star represents a « hole ». Right click on this image and save it to your computer.

../_images/cpetry.png

This software converts a height map into a normal map and shows an example on a cube.

Picture to height map

This step is more difficult, but current deep learning technique can handle it. Using google image, perform a research on « face coin » and select a nice clean picture of a coin.

../_images/sculptok.png

Multiple height maps have been computed, but only the fourth one appears to be correct: the European continent shares the same shade of white as the digit 1.. Download a normal map and test it:

../_images/cpetry2.png

Create silver coin

  • Download the following asset:

  • In Unity, instantiate a coin prefab

  • Create a new material named silver

    • Select a nearly white base color

    • Increase its metallic value

    • Increase its smoothness

    ../_images/silver.png
  • Drag and drop the normal map

  • Apply this material to the coin

    ../_images/star.gif

Create Lincoln coin

  • Download the following asset:

  • In Unity, instantiate a coin prefab

  • Create a new material named copper

    • Select an orange base color

    • Increase its metallic value

    • Increase its smoothness

    ../_images/copper.png
  • Drag and drop the normal map

  • Apply this material on the coin

    ../_images/lincoln.gif

Create 1 euro coin

  • Download the following assets:

    • In Unity, instantiate a coin prefab

    • Create a new material named euro

      • Use the color texture as a BaseMap

      • Change Base map Color to white

      • Increase its metallic value

      • Increase its smoothness

      ../_images/euro.png
    • Drag and drop the normal map

    • Apply this material on the coin

      ../_images/euro.gif

Groups

Stacks

We will put some stacks of chips in the environment. Stacking objects with the mouse is tricky: it takes time and this requires precision. Chips may overlap or slide around… We prefer to use Unity’s physics engine.

  • Create a stack of chips with some spacing between them

  • Select all the chips and create a parent

  • Rotate the stack by 1 or 2 degree to create a pize tower effect

../_images/stack.png
  • Enter play mode

  • Wait for the chips to stabilize

../_images/fall2.gif
  • Press Pause Button

  • In the Hierarchy, select the parent node

  • Drag and drop the stack into the Project Assets folder to create a prefab

    ../_images/stackprefab.png
  • Stop Play mode

  • Now you can set up stacks quickly

Circular stack

  • Create 2 chips side by side

  • Duplicate them and rotate them by 90°

  • Select the 4 chips and duplicate them

  • Move the new 4 chips upward and rotate them by 90°

    ../_images/8.png
  • Select these 8 chips, duplicate them and create a new layers

  • Repeat multiple times

  • Select all chips and create a parent

  • Enter Play mode

    ../_images/PILE.gif
  • In the Hierarchy, select their parent node

  • Drag and drop it in the assets folder to create a prefab

    ../_images/88.png

Triangular stack

This configuration works better with coins because they are smaller.

  • Start with a base of 6 coins

  • Duplicate this base 4 times and stack the coins

  • Duplicate 5 stacks of 5 coins to create the next layer

  • Repeat until you reach the top

    ../_images/triangular.gif

Environment

Now, you have enough assets to create your first level. For inspiration, here are some levels from the original game:

../_images/img1.png ../_images/img2.png ../_images/img3.png ../_images/img4.png ../_images/img5.png ../_images/img6.png ../_images/img7.png ../_images/img8.png ../_images/img9.png ../_images/imga.png ../_images/imgb.png ../_images/imgc.png

Third platform

Avertissement

Please make sure that both existing platforms are sized 5x0.6x10.

  • Create a 3D cube scaled to 8x0.6x3

  • All three platforms should have the same X position to be properly centered and aligned

  • The Y-value of the third platform should be -0.6

../_images/3platforms.png

Left side

Avertissement

The dimensions given here are for guidance only, to show you how the example set was built. You can of course choose your own shapes and sizes, and take a look at our method to find some helpful tips.

  • Create a 3D cube scaled to 3x2x3

  • Snap it carefully, the final position matters

  • After that, lift it slightly to create a small border

../_images/a2.gif

We recall how to snap:

  • Select a cube

  • Activate the Translation tool

  • Hold V Key

  • Click and hold a vertex

  • Move mouse to snap this vertex to another vertex in the scene

Then:

  • Create a 3D cube scaled to 5x5x1

  • Set its Z-rotation to 30

../_images/a1.png
  • Snap it carefully, the final position matters

../_images/a3.gif

Next:

  • Create a 3D cube scaled to 3x2x3

  • Set its Y-rotation to 30

../_images/a4.png
  • Snap it carefully, the final position matters

../_images/a5.gif

After that:

  • Create a 3D cube scaled to 2x2x2

  • Snap it to adjust its height

  • Position it so that it touches the border

../_images/a6.gif

We have built the left site of our set:

../_images/a7.png

Right side

  • Select the four blocks and duplicate them (CTRL-D)

  • Move them to the right side

  • Invert the rotation values: 30 → -30 to obtain symmetric blocks

    ../_images/a8.png
  • Perform the same steps to build the right side symmetrically.

    ../_images/a9.png
  • Final result:

    ../_images/a10.png

Side walls

  • Create a 3D cube with scale parameters 0.1x5.6x6

  • Snap it to adjust its vertical position

  • Move it to the left to create a small edge

    ../_images/b2.gif
  • Duplicate this wall to create the right wall

    ../_images/b3.png

Back wall

  • Create a 3D cube with scale parameters 9.5x5.2x0.1

  • Snap it to the top of the moving platform

    • Beware, the back wall must be positioned above the moving platform

  • Set its X-coordinate to 0 to center the wall

    ../_images/b4.gif

Decoration

Walls

  • Visit the website : https://3dtextures.me/

  • Find a texture with bump for the walls

  • Create a new material

    • Metallic : 0

    • Smoothness : High

  • Apply it to the side blocks

  • Adjust the light’s direction so that it shines from the top-left (rotation only matters)

    ../_images/b7.png

Clock

We want to create an analog clock on the left wall

  • Create a hour marker using a cube

  • Use a cylinder to create the center of the clock

../_images/step5.png
  • Use the following script to create the 12 clock markers

using UnityEngine;
using UnityEditor;

public class CircularInstancerEditor
{
        [MenuItem("Tools/Circular Duplicate in YZ Plane (use 'center' object)")]
        public static void DuplicateInCircleYZ()
        {
                GameObject original = Selection.activeGameObject;
                GameObject centerObject = GameObject.Find("center");

                Vector3 center = centerObject.transform.position;
                float radius = 3f;
                int numberOfCopies = 12;

                for (int i = 0; i < numberOfCopies; i++)
                {
                        float angle = i * Mathf.PI * 2f / numberOfCopies;

                        float y = center.y + Mathf.Cos(angle) * radius;
                        float z = center.z + Mathf.Sin(angle) * radius;
                        float x = center.x;

                        Vector3 position = new Vector3(x, y, z);

                        GameObject copy = Object.Instantiate(original, position, Quaternion.identity);
                        copy.name = original.name + "_copy_" + i;

                        Vector3 angles = copy.transform.eulerAngles;
                        angles.x = 360 / numberOfCopies * i;
                        copy.transform.eulerAngles = angles;

                        copy.transform.SetParent(centerObject.transform);
                }
        }
}
  • Create the three clock hands

  • Create a single script and apply it to each clock hand to animate them.

    • The speed can be adjusted via a public variable

    • Placing each clock hand inside a parent GameObject can help manage rotation more easily

    ../_images/step8.gif

    video at 30x speed

Level design

Stack of chips

  • Create various stacks of chips - see method here

  • Create some prefabs to simplify level creation

    • Organization is the key!

    ../_images/stacks.png
  • Create your own arrangement of chip stacks to design the level

    • The picture I provided is just an example — don’t copy it, make your own!

    ../_images/stack2.png
  • Maintain a clean Hierarchy to stay organized

    ../_images/stack3.png

Sides

The clock makes the wall look nicer and not empty. So we put some decoration on both sides.

  • Put some prefabs in the air

  • Enter Play mode and try to generate a nice fall

../_images/fall21.gif
  • Still in Play mode, select the chips in the Hierarchy and create an empty parent

  • Drag and drop this parent to create a new prefab

  • Exit Play mode and use the prefab to place the chips where you like

../_images/level.png

Optimization

Everything is costly when working in real time. So when you don’t need certain features (like physics simulation or shadows), it’s better to disable them.

  • Turn off the Cast Shadows option (mesh render)

    • Shift select multiple elements

    • In the Inspector, disable the option — the change will be applied to all selected objects

    • Check:

      • Main pusher

      • Walls

      • Platforms

      • Clock markers

  • Check that these types of objects do not have a Rigibody - they do not move

    • Walls

    • Platforms

    • Clock markers

Coin shower

Now we need to place lots of coins to fill the empty space:

../_images/coins.png

Script V1

Nevertheless, doing it by hand can be time-consuming. So, we use a script to generate the coins and let the physics engine place them in the level.

  • Create a 3D cube floating above the medium platform as a cloud

  • Activate its Trigger option to disable collision (coins may bounce)

  • Create a script and attach it to this object

  • Here is a function that generates a random position inside this box:

    public Vector3 GetRandomPointInside()
    {
            Vector3 size = boxCollider.size;
            Vector3 center = boxCollider.center;
    
            Vector3 localRandom = new Vector3(
                    Random.Range(-size.x / 2f, size.x / 2f),
                    Random.Range(-size.y / 2f, size.y / 2f),
                    Random.Range(-size.z / 2f, size.z / 2f)
            );
    
            // Transform to world coordinates considering scale and rotation
            return boxCollider.transform.TransformPoint(center + localRandom);
    }
    
  • We present a Coroutine used to spawn a coin every x second

    void Start()
    {
            StartCoroutine(SpawnLoop());
    }
    
    
    IEnumerator SpawnLoop()
    {
            while (true)
            {
                    Vector3 P = ...
                    Instantiate(...);
                    yield return new WaitForSeconds(...);
            }
    }
    
  • Finish writing the script so everything works properly

First test

  • Enter Play mode

    ../_images/oups.gif
    • Oups… It’s like a real bowling game — we need to make sure the chips stay in place!

Freeze the chips

  • We suppose that all your chips are named Chips_XXX in the hierarchy

    • In the search bar at the top of the Hierarchy window, type « chip »

    ../_images/search.png
    • In the scene view, Unity displays all the selected objects:

    ../_images/select.png
    • Press Ctrl-A to select all the elements in the search field

    • You should see the RigidBody component in the Inspector

      • Eventually, unselect any hierarchy nodes named « chips_group »

      • Any change made in the Inspector will be applied to all selected objects

    • Enable their Kinematic option to prevent them from moving

  • Enter Play mode

Script V2

  • Create a second spawner to rain on the lower platform

  • The script must instantiate the three different types of coins

  • Coins must start horizontally

  • Reduce spawner speed to 10 coins/s

    ../_images/rain2.gif
  • Let’s have a look at the result

    ../_images/rain3.png

Yep ! We got it !

Script V3

The script works fine; nevertheless, some polishing still needs to be done by hand:

  • Some coins fall outside the scene and keep falling infinitely

  • Some coins land on the sides (orange area); we need to delete them

  • Some coins fall onto the stacks; we have to remove them

It’s quite easy to write a script to remove these annoying coins and simplify our work. To do this, we use the RayCast technique: we shoot a virtual ray, like an arrow, from the center of each coin toward the ground. If the ray hits something, we check the type of the obstacle. This allows us to determine whether the coin should be removed or not. Here is an example:

RaycastHit hit;
float maxDist = 0.1f;
if (Physics.Raycast(transform.position, Vector3.down, out hit, maxDist))
{
        string N = hit.collider.gameObject.name;

        if ( N.Contains("...") )
                Destroy(this.gameObject);
}

We then have to perform a second check: if the Y-coordinate of a coin is too low, we need to destroy it because it has fallen out of bounds.

  • Create a new script

  • Attach this script to the 3 coins prefabs

  • Add the necessary test to perform automatic removal of annoying coins

../_images/rain4.gif
  • Very nice result!

../_images/rain5.png

Script V4

It remains to copy paste all these coins into a prefab. For this, we create a reference object at 0,0,0 and attach all the coins to it.

  • Create an empty gameObject located at 0,0,0

  • Modify the script to attach each coin to this reference object (through the Instantiate method)

  • Enter Play mode

  • Pause the game, when you have enough coins

  • Drag and drop the reference object into the assets folder to create a prefab containing all the coins

  • Stop the Game

  • Instantiate the Prefab

  • Select the reference of the prefab and reset its coordinates to 0

The end

We finish this step by cleaning up the scene:

  • Select the two spawners and disable them (Inspector)

  • Select the chips and disable their Kinematic options

  • On each coin prefab, disable the « cleaner » script

  • If you want to remove some coin (collision problem)

    • Double click on the coin

      ../_images/remove.gif
    • Check that it has not parent node, else select its parent

    • Delete it

Insert coin

To indicate the position of the coins to insert, we use a crosshair placed on the back wall.

Crosshair

Texture

  • the crosshair sprite

  • Drag and drop this file in the assets folder

    • You should see a white rectangle, transparency is not active

  • Click on the asset

  • In the Hierarchy, enable Alpha Is Transparency, scroll down and click Apply

Material

  • Create a new material and apply the texture as a base map

  • Select a color to tint the sprite

Sprite

  • Create a vertical 3D quad and placed it in front of the back wall

  • Apply the new material to the quad

    ../_images/walltarget.png

Move

We want the crosshair to move when the cursor is on the backwall.

  • Some hints:

    • Select your camera, change its tag to: MainCamera

    • Select the quad-crosshair and change its layer to Ignore Raycast

    • You should consider the function OnMouseOver()

  • To obtain a ray starting from the main camera to the direction of the mouse cursor, use the following function:

    Camera.main.ScreenPointToRay(Input.mousePosition);
    
  • The crosshair:

    • must move smoothly and continuously

    • must not blink or disappear

    • is always positioned at the half of the height of the wall

../_images/crosshair.gif

Click

  • When the player clicks the back-wall, drop a coin at the given position

  • You may consider the function: OnMouseDown

  • You may add an initial velocity to speed up the coin fall

../_images/demo.gif

Coin tray

  • Use 3D Cubes to model a coin tray

  • Create a collider at the bottom of the coin tray

    ../_images/collider1.png
    • Add a new script to this collider

  • Position some coins to test the collider

    ../_images/testcollider.png
  • Create HUD

    • Create a canvas inside your scene (do not create an extra scene)

    • Select all the coin pusher elements and translate them apart

    • Here are some sprites for the HUD

    • Display these values:

      • Number of chips for each chip type

      • Number of coins for each coin type

      • Money earned

  • Test your result:

    ../_images/valid.gif

Multi-camera

This step was added afterwards, so it’s possible that the images do not match your current environment.

  • camera sprite

  • In the top right of the HUD

    • Create 6 images with the camera sprite

    • In a single row

    ../_images/cam.png
  • First view: camera in front of the scene, aligned with the pusher

    ../_images/camfrontlow.png
  • Create a new camera for the second view: in front of the scene, higher

    ../_images/camfrontup.png

Note

If you want to see the view from the second camera in the Game view: disable the first camera

  • Create a new camera for the third view: from above the large platform

../_images/camplatformup.png
  • Create a new camera for the fourth view: from above the pusher

../_images/campusherup.png
  • Create a new camera for the fifth view: at the right of the pusher

../_images/cam5.png
  • Create a new camera for the sixth view: at the right of the large platform

../_images/cam6.png
  • Create a script and attach it to each image in the HUD

    • To make the image react to mouse click

    public class ImageClickHandler : MonoBehaviour, IPointerClickHandler
    {
            public void OnPointerClick(PointerEventData eventData)
            {
                    Debug.Log(gameObject.name);
            }
    }
    
  • When an image is clicked, change the active camera

    • By carefully choosing the name or the tag of your images, the same script can be used for all cameras

Avertissement

Check that the crosshair and the coin generation still works correctly.

  • Here is a demo of the final result:

../_images/democam.gif

Lighting

Since the beginning, we have only used one directional light. It’s time to improve the lighting in our scene.

Switch off the lights

  • Select the Direction Light and disable it

  • Select the Camera and set a black background

    ../_images/lighting2.png
  • Go to Window > Rendering > Lighting > Environment

    • Set the two multipliers to 0

    ../_images/lighting.png
  • Enter Play mode

    • It’s completely black

Placing spotlights

To dynamically see the shades of light in the scene, click on this icon:

../_images/shade.png
  • Create a white spot light

    • Intensity 1

    • Rot (90,0,0) - directed downward

    • Range 100 - unlimited

    • Inner Outer 130-170 - large

  • Place the lamp in the middle of the large platform

  • Make the lamp go up and down

  • Find the right placement: not too saturated in a small area, nor too wide and dull

    ../_images/light.gif
  • Duplicate to create two lights: one on the left, one on the right

    ../_images/light2.gif

We add orange spheres to see the locations of the lamps

  • Duplicate two lights and translate them near the left and right border

  • If needed, position them slightly higher

    ../_images/light3.gif
  • Add more lights

    • Select the row of 5 lights

    • Duplicate and place this new row near the border

    • Duplicate and place this new row above the pusher

    • Add two lights at the back

    ../_images/light4.png
  • Select all the lights

  • Move them vertically to find the position you consider optimal

    ../_images/light5.gif
  • Duplicate three lights to lighten the coin tray

    ../_images/light6.png
  • Add some spot ligths to light the top of the three walls

    ../_images/light7.png
  • Select the directional light

Bloom

We add some special effect in the scene.

Prefab

  • Select your camera

    • Enable Rendering > Postprocessing

  • Create a 3D cube

  • Create a new material

    • Assign this material to the cube

    • Select a white base color

    • Enable emission

    • Click on HDR

      • Select a vibrant color

      • Play with the Intensity parameters

    ../_images/bloom.gif
  • Resize the cube to obtain a small neon

  • Create your prefab

Decorate

  • Set Intensity to 0

  • Add neon to decorate the scene

  • Edit the prefab to adjust neon size if needed

  • Increase the Intensity and observe the result

../_images/bloom2.png

Animate

Create a function that will turn the light on and off, three times in total, 1 blink per second, by changing the intensity parameter from 0 to 10.

  • Use a coroutine

  • Create two materials, with and without bloom

  • Use a parent node to group all your neons:

void SetMat(GameObject group, Material mat)
{
        foreach (Transform child in group.transform)
        {
                GameObject obj = child.gameObject;
                obj.GetComponent<Renderer>().material = mat;
        }
}
../_images/bloom3.gif

Next

Create two groups of neons with two colors!

../_images/bloom4.gif

Last

Our two last demands:

  • Make sure that each time a coin falls into the tray, the animation is triggered

  • If no animation has been triggered after 10 seconds, it should also be triggered automatically

Evaluation criteria

Criteria

  • Coins / chips / environment : 2 points

  • HUD / insert coin : 2 points

  • Bump / lighting : 1 point

  • Multi-camera / Bloom : 1 point

  • Personalization : 4 points

Deliverables

When completed:

  • Right click on your assets folder

    • Select show in Explorer

  • Zip your ASSETS folder

    • Upload it to your drive

    • Share the file and send me the link by email