GMU:Tutorials/Networking/Controlling the Camera in Unity with The Captury: Difference between revisions

From Medien Wiki
No edit summary
No edit summary
Line 1: Line 1:
'''1.open unity and create a new Unity project.'''
'''1.open unity and create a new Unity project.'''
[[Image:1-1|200px|thumb|left|alt text]]
[[Image:1-1|200px|thumb|left]]
'''2. create a simple Unity scene.'''
'''2. create a simple Unity scene.'''


For the purposes of this tutorial, it is recommended to creating a simple plane and shape objects.
For the purposes of this tutorial, it is recommended to creating a simple plane and shape objects.
here I create a cube and a sphere.
here I create a cube and a sphere.
[[Image:2-1|200px|thumb|left|alt text]]
[[Image:2-1|500px|thumb|left]]
[[Image:2-2|200px|thumb|left|alt text]]
[[Image:2-2|500px|thumb|left]]
'''3. add component to camera'''
'''3. add component to camera'''
[[Image:3-1|200px|thumb|left|alt text]]
[[Image:3-1|500px|thumb|left]]
select camera in hierarchy,single click it.
select camera in hierarchy,single click it.
[[Image:3-2|200px|thumb|left|alt text]]
[[Image:3-2|500px|thumb|left]]
click the right of table to add component to the camera.
click the right of table to add component to the camera.
[[Image:3-3|200px|thumb|left|alt text]]
[[Image:3-3|500px|thumb|left]]
select a new script
select a new script
[[Image:3-4|200px|thumb|left|alt text]]
[[Image:3-4|500px|thumb|left]]
enter a name for this script
enter a name for this script
[[Image:3-5|200px|thumb|left|alt text]]
[[Image:3-5|500px|thumb|left]]
double click the script in Assets,then you will get a script widow, you can write code in it.
double click the script in Assets,then you will get a script widow, you can write code in it.
'''4.write the code.'''
'''4.write the code.'''
this code is for camera, then create a gameobject, this gameobject is the cube, the capture system will send the position of the root bone to the cube, then the script will make the camera follow the cube.
this code is for camera, then create a gameobject, this gameobject is the cube, the capture system will send the position of the root bone to the cube, then the script will make the camera follow the cube.
[[Image:4-1|200px|thumb|left|alt text]]
[[Image:4-1|500px|thumb|left]]
'''5.set the data related to the capture system.'''
'''5.set the data related to the capture system.'''
[[Image:5-1|200px|thumb|left|alt text]]
[[Image:5-1|500px|thumb|left]]
Then in the right table, you can set the remote IP and the port of the main computer.
Then in the right table, you can set the remote IP and the port of the main computer.

Revision as of 21:54, 30 July 2016

1.open unity and create a new Unity project.

2. create a simple Unity scene.

For the purposes of this tutorial, it is recommended to creating a simple plane and shape objects. here I create a cube and a sphere.

3. add component to camera

select camera in hierarchy,single click it.

click the right of table to add component to the camera.

select a new script

enter a name for this script

double click the script in Assets,then you will get a script widow, you can write code in it. 4.write the code. this code is for camera, then create a gameobject, this gameobject is the cube, the capture system will send the position of the root bone to the cube, then the script will make the camera follow the cube.

5.set the data related to the capture system.

Then in the right table, you can set the remote IP and the port of the main computer.