GMU:Techniken des Virtuellen/Miaomiao Ning: Difference between revisions

From Medien Wiki
Line 47: Line 47:
A test was done, in which the pulse data collected from person is used to control the angle of blocks in Unity.
A test was done, in which the pulse data collected from person is used to control the angle of blocks in Unity.
[https://www.youtube.com/watch?v=RbPW2_f4YVk| Test video:Use pulse sensor in unity3D ]<br>
[https://www.youtube.com/watch?v=RbPW2_f4YVk| Test video:Use pulse sensor in unity3D ]<br>
[[File:connect pulse sensor with Unity.png|left|250px|]]
[[File:connect pulse sensor with Unity.png|left|220px|]]


———Unity script——————————————————————<br>
———Unity script——————————————————————————<br>
using System.Collections;<br>
using System.Collections;<br>
using System.Collections.Generic;<br>
using System.Collections.Generic;<br>
Line 61: Line 61:
serial.Open ();<br>
serial.Open ();<br>
int rotation = int.Parse (serial.ReadLine ());<br>
int rotation = int.Parse (serial.ReadLine ());<br>
transform.localEulerAngles = new Vector3(0, rotation,<br>
transform.localEulerAngles = new Vector3(0, rotation,0);}}<br>
0);}}<br>
———Unity script——————————————————————————<br>
———Unity script——————————————————————<br>