In the final exercise you will apply all of the digital artifacts you have created this semester as elements to create your very own virtual world called “The Ecology of Forms”.
1-Please follow this lecture to better understand the tasks below. LINK
2-This is an example from a group of your colleagues from the previous year. LINK, and some more examples at this link and in the images below.
3-Here you will find the continuation of the tutorials started in Amplify necessary for you to complete your core skills. LINK



Instructions
- Choose an ecology from the list
- Volcano
- Sky
- Jungle
- Desert
- Ocean
- Sketch.
- Prepare at least 2 horizontal A3’s divided into 8 boxes where in each you will represent the story of your ecology. To be evaluated.
- How will you manifest the given ecology using what you know and the models and textures you have created?
- What forces are at play?
- What are the key objects and interactions?
- How many levels are there?
- What’s the objective of the game, do you have a scoreboard, how do you interact with the world around you and vice versa?
- Note: Do not be literal — use the ecology as a starting point.
- You are not allowed to use any assets outside of your own. You should rely on the content generated throughout the course and additionally create your own (in unity or rhino).
- Prototype. Build up your ecology by developing more simple elements in separate scenes. Make sure to take care about naming and the file structure – it will get complicated quickly!
- Create at least 5 different scenes where you test some of the new physics elements that you will find in the tutorials below. Hint: joints, constraints, springs, particles etc. To be evaluated.
- Sketch & Prototype again. Think about what you learned from your experiments and how you can implement it in your own game.
- Interaction – how will someone interact with your world, do they walk, fly, swim ect. Augmented Reality / VR are also options.
- Sound – you may choose to incorporate sound as well into your world
Do
- Experiment, create, and explore
- Check out other examples online to get ideas
- Ask your professor for input
Don’t
- Copy other examples directly
- Use pre-built assets
- Interpret the brief in a literal way
DELIVERABLES.

- 300 word description of your ecology.
- What is its name?
- What is the concept?
- How did you take advantage of the Game Engine transform the elements from the previous modules?
- How does the user interact?
- 2 A3’s with 16 boxes of sketches of your storyboard. Indicate forces, gameobjects, materiality, and interactions
- 5 videos of experiments of game physics
- 5-10 Screenshots of different tests.
- Following the deliverables above next week, you should start developing your game and share your updates every time for additional feedback until the end of the semester.
How to Record your Screen
- Video Export Plugin | https://www.youtube.com/watch?v=xFGMfK3U9cI
- Windows | https://camstudio.org/
Before starting to work on your Ecology Project make sure you follow this video tutorial LINK we’ve prepared for you that will further develop your unity skills, remember that these are just tips and tricks of the core elements and you need to do further research and check out other tutorials to develop skills that might be more specific to the final project you have in mind.
AMPLIFY 2 of 3
8 Creating and Saving a Scene
Within your unity project you created from lab one you will create a new scene. Whenever you start a new project, you will see an empty unsaved and untiled ‘scene’. A project may have multiple scenes, but each scene will have access to the same files in the project. For more about unity scenes visit this link
- Save your the scene, by going to file-> ‘save scene as’
- Navigate to the scene folder in your project assets directory. Name the scene “Amplify 1”
- Now create a new scene for todays work. Going to file->new scene
- Save your the scene, by going to file-> ‘save scene as’
- Navigate to the scene folder in your project assets directory. Name the scene “Amplify 2”
- When you save the scene, an icon will appear in the assets folder. You can navigate to your previous work by clicking on the corresponding scene.
2 Spring & Hinge Joints
Spring Joint
The Spring Joint joins two Rigidbodies together but allows the distance between them to change as though they were connected by a spring.
- Create an empty GameObject.
- Click and drag two prefabs or primitive game objects into the empty game object folder located in the scene window. Make sure each game object has a rigid body.
- Select one of the objects (“jack”).
- Disable the Gravity option.
- Add a spring hinge component
- Now click and drag the second game object (‘jack(1) in this case into the “connected body field” under spring joint.
- The options for your first object should look like this.
- Press the play button. What happens?
- Lets try freezing the position of our object. Under ‘constraints’ and check the option to free the position
- Press the play button. What happens?
- Explore more of the Spring Joint settings. Try changing the values for ‘Spring’, Sample, Min Distance, Max & Distance
Hinge Joint
“The Hinge Joint groups together two Rigidbodies, constraining them to move like they are connected by a hinge. It is perfect for doors, but can also be used to model chains, pendulums, etc.” (Unity Manual)
- Create an empty GameObject.
- Click and drag two prefabs or primitive game objects into the empty game object folder located in the scene window. Make sure each game object has a rigid body.
- Select one of the objects (“jack”).
- Disable the Gravity option.
- Add a Hinge hinge component
- Now click and drag the second game object (‘jack(1) in this case into the “connected body field” under Hinge Joint
- The options for your first object should look like this.
- Press the play button. What happens? What is the difference between a Spring Joint and a Hinge Joint?
- Try creating a chain of objects using spring and hinges
Motor
How to add a motor to an object to make it spin around
- Add a new game object or prefab to the scene
- Add a hinge joint component to this object
- Select the ‘motor’ option. Set the velocity and force to 100
- Press Play
2 Import Mesh & Texture Import
Import a Custom Obj
You can add your own objects to the scene
- Save the objects you want to use in your Ecology of Forms directory
- Right click on the options menu
- Select the option ‘import asset’. Navigate to the file you would like to use and click the ‘import’ button
- The obj will now appear in your assets toolbar
Add a mesh Collider
To have the imported object interact with other game objects, you will need to add a mesh collider.
- Create an empty game object
- Click and drag the imported obj from the assets folder into the game object tab
- Click on the game object tab
- On the right tool-bar, click on ‘add component’
- Search for and select ‘mesh collider’. Almost there!
- Under the mesh collider options select mesh. A menu will pop up. Select the obj file you imported and use it as the mesh collider.
- MAKE SURE TO SET COOKING OPTIONS TO NONE
- Done! When you click on the game object tab again, your model should look like this. The green highlight is showing the mesh collider
- Let’s drop some objects onto this object to see if it works.
- Try adjusting the physics material
Custom Texture
- Save the textures you want to use in your Ecology of Forms directory
- Right click on the options menu
- Select the option ‘import asset’. Navigate to the file you would like to use and click the ‘import’ button
- Click and drag the texture onto your object.
- If you click on the object again, some
3 C# Scripts
Particle Emitter
- In the assets tool, create new folder called “C# scripts”
- Navigate into the “C# Scripts” folder
- Right click on the assets toolbar, and select “CREATE”-> “C# Script”
- Rename the C# Script “MyEmitter”
- Double-click on the c# script icon, microsoft visual studio will open
- Copy and paste this code into the code editor:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyEmitter : MonoBehaviour
{
public GameObject emit;
public GameObject spam;
public Vector3 dir;
public float delay = 1f;
private float count = 0f;
void Update()
{
count += Time.deltaTime;
if (count > delay)
{
float randomRot = Random.Range(-90f, 90f);
float randomSpeed = Random.Range(-5f, 5f);
GameObject clone = Instantiate(
spam,
emit.transform.position,
Quaternion.Euler(new Vector3(0f, randomRot, 0f))
);
Rigidbody rb = clone.GetComponent<Rigidbody>();
if (rb != null)
{
rb.linearVelocity = transform.forward * randomSpeed;
}
count = 0f;
}
}
}
- Press Ctrl+Shift+B to build the solution
- Close the code editor
- Create an empty GameObject (click “gameobject from the top toolbar and then select “create game object”), rename it to “Emitter”
- Create a Sphere object. Remove the sphere collide
- the location of the sphere will be where the particles are emitted from.
- In the “Emitter” object, add the “MyEmitter” object. .
- In the “emitter” options, click and drag the “sphere” object into the “emit” option
- In the “emitter” options, click and drag the prefab of choice to be emitted.
- Press run
Wind
- Creating Rigid Body Wind Zones pt. 1 https://www.youtube.com/watch?v=iCMhrKOuBZg
- Creating Rigid Body Wind Zones pt. 2 https://www.youtube.com/watch?v=ryZ2WZdAlD0
- Like the emitter example, create a C# Component called “WindArea” that contains the following code:
using UnityEngine;
public class WindArea : MonoBehaviour
{
public float Strength;
public Vector3 WindDirection;
void OnTriggerStay(Collider col)
{
Rigidbody colRigidbody = col.GetComponent<Rigidbody>();
if (colRigidbody != null)
{
colRigidbody.AddForce(WindDirection * Strength);
}
}
}
- Create an empty GameObject
- Add a box collider component
- Change the scale of the box collider component
- Within the box collider component, make sure that “isTrigger” is checked
- Add the custom component “WindArea”
- For the wind area component, be sure to add a direction and wind strength
- Run the script
Fly Camera
Create a new C# Component called “FlyCamera” that contains the following code:
using UnityEngine;
using System.Collections;
public class FlyCamera : MonoBehaviour
{
/*
Writen by Windexglow 11-13-10. Use it, edit it, steal it I don't care.
Converted to C# 27-02-13 - no credit wanted.
Simple flycam I made, since I couldn't find any others made public.
Made simple to use (drag and drop, done) for regular keyboard layout
wasd : basic movement
shift : Makes camera accelerate
space : Moves camera on X and Z axis only. So camera doesn't gain any height*/
float mainSpeed = 100.0f; //regular speed
float shiftAdd = 250.0f; //multiplied by how long shift is held. Basically running
float maxShift = 1000.0f; //Maximum speed when holdin gshift
float camSens = 0.25f; //How sensitive it with mouse
private Vector3 lastMouse = new Vector3(255, 255, 255); //kind of in the middle of the screen, rather than at the top (play)
private float totalRun = 1.0f;
void Update()
{
lastMouse = Input.mousePosition - lastMouse;
lastMouse = new Vector3(-lastMouse.y * camSens, lastMouse.x * camSens, 0);
lastMouse = new Vector3(transform.eulerAngles.x + lastMouse.x, transform.eulerAngles.y + lastMouse.y, 0);
transform.eulerAngles = lastMouse;
lastMouse = Input.mousePosition;
//Mouse camera angle done.
//Keyboard commands
float f = 0.0f;
Vector3 p = GetBaseInput();
if (Input.GetKey(KeyCode.LeftShift))
{
totalRun += Time.deltaTime;
p = p * totalRun * shiftAdd;
p.x = Mathf.Clamp(p.x, -maxShift, maxShift);
p.y = Mathf.Clamp(p.y, -maxShift, maxShift);
p.z = Mathf.Clamp(p.z, -maxShift, maxShift);
}
else
{
totalRun = Mathf.Clamp(totalRun * 0.5f, 1f, 1000f);
p = p * mainSpeed;
}
p = p * Time.deltaTime;
Vector3 newPosition = transform.position;
if (Input.GetKey(KeyCode.Space))
{ //If player wants to move on X and Z axis only
transform.Translate(p);
newPosition.x = transform.position.x;
newPosition.z = transform.position.z;
transform.position = newPosition;
}
else
{
transform.Translate(p);
}
}
private Vector3 GetBaseInput()
{ //returns the basic values, if it's 0 than it's not active.
Vector3 p_Velocity = new Vector3();
if (Input.GetKey(KeyCode.W))
{
p_Velocity += new Vector3(0, 0, 1);
}
if (Input.GetKey(KeyCode.S))
{
p_Velocity += new Vector3(0, 0, -1);
}
if (Input.GetKey(KeyCode.A))
{
p_Velocity += new Vector3(-1, 0, 0);
}
if (Input.GetKey(KeyCode.D))
{
p_Velocity += new Vector3(1, 0, 0);
}
return p_Velocity;
}
}
- Add the fly camera component to your camera
- Run the game
- Use the following controls to move the camera
wasd : basic movement
shift : Makes camera accelerate
space : Moves camera on X and Z axis only. So camera doesn’t gain any height*/
OTHER EXAMPLES
11.1 Random Object Motion
11.2 How to model a snake
11.3 Unity Tutorial | Spawning Random Enemies at Random Times and Positions
11.4 Using your voice to control your Unity3D model
11.5 Destroy an object after a certain time period
Create a c# script called “DestroyByTime” and insert the following text.
using UnityEngine;
using System.Collections;
public class DestroyByTime : MonoBehaviour
{
public float lifetime;
void Start () { Destroy (gameObject, lifetime); }
}
11.5 Spawn objects in a grid
-create an empty script and rename it to SpawnMe
-create an empty game object and assign the SpawnMe script to it
-go on the game object and in the script panel assign the object that you want to spawn as well as the size of the grid.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnMe : MonoBehaviour {
public GameObject spawn;
//public
public float spacing;
public float numX, numY, numZ;
// Use this for initialization
void Start()
{
for (float x = 0; x < numX*spacing; x += spacing)
{
for (float y = 0; y < numY*spacing; y += spacing)
{
for (float z = 0; z < numZ*spacing; z += spacing)
{
Vector3 position = new Vector3(x,y,z);
Instantiate(spawn, position, Quaternion.identity);
}
}
}
}
// Update is called once per frame
void Update () {
}
}
11.7 Control an object with the keyboard
using System.Collections;using System.Collections.Generic;
using UnityEngine;
public class MyPlayer : MonoBehaviour {
public float speed = 1;
public float spacing = 1;
private Vector3 pos;
// Use this for initialization
void Awake () {
pos = transform.position;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.W))
pos.y += spacing;
if (Input.GetKeyDown(KeyCode.S))
pos.y -= spacing;
if (Input.GetKeyDown(KeyCode.A))
pos.x -= spacing;
if (Input.GetKeyDown(KeyCode.D))
pos.x += spacing;
transform.position = Vector3.MoveTowards(transform.position, pos, speed * Time.deltaTime);
}
}
11.8 Add a magnet :
Make sure magnet layers are set to everything
using UnityEngine;
using System.Collections;
public class Magnetic : MonoBehaviour
{
public LayerMask m_MagneticLayers;
public Vector3 m_Position;
public float m_Radius;
public float m_Force;
void FixedUpdate()
{
Collider[] colliders;
Rigidbody rigidbody;
colliders = Physics.OverlapSphere(transform.position + m_Position, m_Radius, m_MagneticLayers);
foreach (Collider collider in colliders)
{
rigidbody = (Rigidbody)collider.gameObject.GetComponent(typeof(Rigidbody));
if (rigidbody == null)
{
continue;
}
if (gameObject.GetComponent<Rigidbody>() != rigidbody)
{
rigidbody.AddExplosionForce(m_Force * -1, transform.position + m_Position, m_Radius);
}
}
}
void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position + m_Position, m_Radius);
}
}
11.8 following a object with a camera
https://unity3d.com/learn/tutorials/projects/2d-ufo-tutorial/following-player-camera
using UnityEngine;
using System.Collections;
public class CompleteCameraController : MonoBehaviour {
public GameObject player; //Public variable to store a reference to the player game object
private Vector3 offset; //Private variable to store the offset distance between the player and camera
// Use this for initialization
void Start ()
{
//Calculate and store the offset value by getting the distance between the player's position and camera's position.
offset = transform.position - player.transform.position;
}
// LateUpdate is called after Update each frame
void LateUpdate ()
{
// Set the position of the camera's transform to be the same as the player's, but offset by the calculated offset distance.
transform.position = player.transform.position + offset;
}
}
11.9 Microphone Input
https://docs.unity3d.com/Manual/class-Microphone.html
using UnityEngine;
using System.Collections;
public class MicInput : MonoBehaviour{
public float testSound;
public static float MicLoudness;
private string _device;
private AudioClip _clipRecord = new AudioClip();
private int _sampleWindow = 128;
private bool _isInitialized;
void InitMic()
{
if (_device == null) {
_device = Microphone.devices [0];
_clipRecord = Microphone.Start (_device, true, 999, 44100);
Debug.Log (_clipRecord);
}
}
void StopMicrophone()
{
Microphone.End (_device);
}
float LevelMax()
{
float levelMax = 0;
float[] waveData = new float[_sampleWindow];
int micPosition = Microphone.GetPosition (null) - (_sampleWindow + 1);
if (micPosition < 0) {
return 0;
}
_clipRecord.GetData (waveData, micPosition);
for (int i = 0; i < _sampleWindow; ++i) {
float wavePeak = waveData [i] * waveData [i];
if (levelMax < wavePeak) {
levelMax = wavePeak;
}
}
return levelMax;
}
void Update()
{
MicLoudness = LevelMax ();
testSound = MicLoudness;
}
void OnEnable()
{
InitMic ();
_isInitialized = true;
}
void OnDisable()
{
StopMicrophone ();
}
void OnDestory()
{
StopMicrophone ();
}
void OnApplicationFocus(bool focus)
{
if (focus) {
if (!_isInitialized) {
InitMic ();
_isInitialized = true;
}
}
if (!focus) {
StopMicrophone ();
_isInitialized = false;
}
}
}