GMU:Human and Nonhuman Performances II SS16/Yuxin Tan

From Medien Wiki

Idea introduction

1.Meanings of balance
- Balance of life
God is fair to everyone. For instance, the snail has a strong shell, but it moves slowly. the fish can swim free in the water, but it will die when it is exposed to the air. Only so, the life would reach a level of balance, and the nature would reach the state of balance as well.

- Balance with body
Live in a city, every lamp can light up a story, but not every story can enrich a period of life. A sort of protagonist in the story keeps working day and night. They know how to type computer quickly,how to work effectively, how to smile to colleague accurately, but maybe they never try to understand their body. As a individual, the more integrated into society, the more our body posture tend to social cognition. So the relationship between body and soul is a widespread question in the world. Rather than treating body as the obstacle to the soul, people should treat the body as a bridge to their soul. According to having the conversion with bodies, individual can learn more about themselves, then achieve a state of balance in their own life.

- Balance with environment
The only constant in the world is change. How to find the balance in the changeable world is one of the most important subject in our life. It is a process which from finding the change of environment to reacting to it. And the process is also can be renamed as study. From a balance status to another balance status, it shows the most notable features: live, dynamic, energetic. It means there are a number of external factors affect the balance ,instead of in a isolate scene.

2.Put the concept of balance in our game
- the basic scene
- the object in the scene
- as players,how to interactive with the game


Working flow

- Motion capture system get users’ movement data
- The model of players and scene were built in blender
- Unity
software

Visual theme

Firstly, we want to use dots, line and face as the basic pattern, like the geometrical form. Then we want to do some transform to the basic pattern such as repetition, superimposed, offset and so on.
visual

Secondly, for color matching, we want to use fluorescence color as the main color, like pink, blue and purple. We also want to use grey and yellow and other colors as the complementary color.
Thirdly, for the color pallet, we want to create something that people wouldn’t believe it is real, like a dream, or a psychedelic trip.
visual visual

But after we put these style in game we found we can't control the movement of texture, it didn't reach our expectation so we chose a simple way to express it. The background is red and the player are light yellow cube. The texture looks like mottled printed paper
visual

Coding part

This program has two main parts. One is to connect the Unity and theCaptury, and send the position data of each bone to the game object. The other is to control the environment parameters and generate a plain and a ball.

These are all game objects in this project. Including all the models and scripts and other setting like camera and UI. This concept is based on object-oriented programming so that users can add components to each object based on their needs.
unity

1.Connecting Unity and theCaputry.
TheCaputry provides API for Unity applications. It uses UDP as its Internet protocol suite. In “Osc_Receive_tutorial” this script we should set remoteIP or local host if tested locally, listening port and sending port. Taking into account the stability of the system the listening and sending port should be 1065.
unity

In this project we have at least two or three players on stage. To define every bone in every player and put them in an array. These are all bones that can be recognized by theCaputry.
unity

Unity has its own humanoid system to recognize the bones in model and match it. Users need to define animation type and avatar definition. Next step is to initialize on start up to listen for messages make sure this game object has both UDPPackIO and OSC script attached. Subscribing for the position data from theCaputry with a certain format.

''"/subscribe/name of the model/blender/Root/vector 50.0 0.0 20.0"''

Then the position of xyz axis is obtained and stored in a variable and transfer to a game object.

case "/Fiona_fit/blender/Root/vector":
            hip[0] = values[0];
            hip[1] = values[1];
            hip[2] = values[2];
transHip.transform.position = Vector3(hip[0], -hip[2], hip[1]);

Because Unity is go up on the Y axis and theCaptury is go up on the Z axis, so pay attention to the location of the array when an game object is assigned to the position data.


2.Generating plain
In the second part complete three tasks. Selecting one bone on each player randomly then make up a plain or a line then generating a ball above it, the position of each player will change by the movement of each participants.
unity At first we should define every bone of players and put them in an array. We classify these bones and delete three spine bone because if they were selected player were not easy to adjust their gesture.

private string[] points1 = new string[17]{"Cube_hip1","Cube_LeftShoulder1","Cube_LeftForeArm1",
        "Cube_LeftArm1","Cube_LeftHand1","Cube_RightShoulder1","Cube_RightForeArm1",
        "Cube_RightArm1","Cube_RightHand1","Cube_LeftUpLeg1","Cube_LeftLeg1","Cube_LeftFoot1",
        "Cube_RightUpLeg1","Cube_RightLeg1","Cube_RightFoot1","Cube_Neck1","Cube_Head1"};

Secondly, get a random number range from 0 to 17 then corresponding to the bone.

a = Random.Range (0, 17);
b = Random.Range (0, 17);
c = Random.Range (0, 17);

cube1 = GameObject.Find(points1[a]);
cube2 = GameObject.Find(points2[b]);
cube3 = GameObject.Find(points3[c]);

Thirdly, by adding MeshRenderer component to three bones to make up a plain and giving them material. Three points are combined with each other can get three vectors and using these vectors to make up a triangle mesh plain.

MeshRenderer mr1,mr2,mr3;
mr1 = cube1.GetComponent<MeshRenderer> ();
mr1.material = select;
mr2 = cube2.GetComponent<MeshRenderer> ();
mr2.material = select;
mr3 = cube3.GetComponent<MeshRenderer> ();
mr3.material = select;

if (sphere.activeSelf != true)
     sphere.SetActive (true);

 face.AddComponent<MeshCollider> ();

// Obtain the mesh renderer component through the name of gameobject (face)
MeshFilter meshFilter =face.GetComponent<MeshFilter>();
MeshRenderer mr_face = face.GetComponent<MeshRenderer>();

mr_face.material = select;

//Obtain the mesh object by mesh filter object
Mesh mesh = meshFilter.mesh;

//Create three vector objects to make up a triangle mesh
Vector3 e,f,g;
e = cube1.transform.position;
f = cube2.transform.position;
g = cube3.transform.position;
mesh.vertices = new Vector3[] {g,f,e};

Vector2 v1, v2, v3;
v1 = new Vector2 (cube1.transform.position.x, cube1.transform.position.z);
v2 = new Vector2 (cube2.transform.position.x, cube2.transform.position.z);
v3 = new Vector2 (cube3.transform.position.x, cube3.transform.position.z);

mesh.uv = new Vector2[] {v1,v2,v3};
mesh.triangles= new int []{0,1,2};


3.Setting environment parameters
We chose to control the environment parameter manually that is to press key to change it. There are force coming from four directions up,down,left and right. There is a function in Unity which can change gravity. Using a a vector to represent force. In this case we add a upward force. When we press the key the ball will flow up.

if (Input.GetKeyDown (KeyCode.A)) 
        {
            Physics.gravity = new Vector3(2, -9.8f,0);
            wind.SetActive (true);
            up.SetActive (false);
            left.SetActive (true);
            right.SetActive (false);
        }