6.Code ​Demos

Here is a simple sample code for developing VAQSO VR with Unity.

a. Proximity ​based ​Activation

Use Collider’s trigger event.

    private void OnTriggerEnter(Collider other)
    {
        string name = other.GetComponent().gameObject.name;

        if (name == "a")
        {
            int value = 100;
            SerialPort.WriteLine("fan 0 " + value.toString());
        }
                
    }

b. Event ​based ​Activation

Activate using key event or button press event.

    void Update()
    {
         
        if (Input.GetKeyDown("1"))
        {
            int value = 100;
            SerialPort.WriteLine("fan 1 " + value.toString());

        }

    }

c. Timing ​based ​Activation

Activate it over time.

    private float timeOut;
    private float time;


    void Update()
    {
        time += Time.deltaTime;

        if(time >= timeOut)
        {
                int value = 100;
                SerialPort.WriteLine("fan 1 " + value.toString());
                time = 0f;

        }

    }

 d. Environmental/area ​based ​activation

For example, activate by using scene change, etc.

    string currentSceneName = SceneManager.GetActiveScene().name;

    if (currentSceneName == "hoge") {
        
        int value = 100;
             SerialPort.WriteLine("fan 1 " + value.toString());

    }

e. 360Video ​Contents ​(Timing ​Based)

Activate at the timing of 360-degree stereoscopic video capture and at the timing of movie playback.

    private MovieTexture texture;

    void Start()
    {
        MovieTexture.Play();
        int value = 100;
        SerialPort.WriteLine("fan 1 " + value.toString());

    }