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.==
Line 8: Line 7:




== 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.
Line 15: Line 14:
here I create a cube and a sphere.
here I create a cube and a sphere.


[[File:add new object.png]]
[[Image:add new object.png|thumb|left|600px]]


[[File:new object in scene.png]]
[[Image:new object in scene.png|thumb|left|600px]]




'''3. add component to camera'''
==3. add component to camera==


[[File:select camera.png]]
 
[[Image:select camera.png|thumb|left|600px]]


select camera in hierarchy,single click it.
select camera in hierarchy,single click it.


[[File:add component.png]]
[[Image:add component.png|thumb|left|600px]]


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


[[File:new script.png]]
[[Image:new script.png|thumb|left|600px]]


select a new script
select a new script


[[File:script name.png]]
[[Image:script name.png|thumb|left|600px]]


enter a name for this script
enter a name for this script


[[File:write code.png]]
[[Image:write code.png|thumb|left|600px]]


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.


[[File:code.png]]
[[Image:code.png|thumb|left|600px]]
 




'''5.set the data related to the capture system.'''
==5.set the data related to the capture system.==


[[File:right table.png]]
[[Image:right table.png|thumb|left|600px]]


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 09:40, 31 July 2016

1.open unity and create a new Unity project.

Unity start.png


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.

Add new object.png
New object in scene.png


3. add component to camera

Select camera.png

select camera in hierarchy,single click it.

Add component.png

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

New script.png

select a new script

Script name.png

enter a name for this script

Write code.png

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.

Code.png


5.set the data related to the capture system.

Right table.png

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