예제 #1
0
    //public CanSpawn can;
    //private static string[] micArray = null;
    // Use this for initialization
    void Start()
    {
        avaCam = GetComponent<cameraAvatar>();
        cardboardSet = GameObject.FindGameObjectWithTag("MainCamera");
        rb = this.GetComponent<Rigidbody>();
        acc = new Vector3(0f, 0f, acceleration);
        camPos = cardboardSet.transform.position;

        AudioSource aud = GetComponent<AudioSource> ();
        aud.mute = true;
        aud.loop = true;
        //foreach (string device in Microphone.devices) {
        //	Debug.Log ("Name" + device);
        //}
        //micArray = Microphone.devices;
        //if (micArray.Length == 0) {
        //	Debug.Log ("No mic device detected!");
        //}
        aud.clip = Microphone.Start(null, false, 5, 44100); // You can change the length of recording here

        cardboardSet.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z - 1.5f);
        cardboardSet.transform.LookAt(this.transform);

        pivot = new GameObject();
        pivot.transform.position = cardboardSet.transform.position;
        pivot.transform.LookAt(this.transform);
        pivot.AddComponent<CardboardHead>();
        //pivot.transform.parent = cardboardSet.transform;
        this.transform.parent = pivot.transform;
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        avaCam = GetComponent<cameraAvatar>();
        cardboardSet = GameObject.FindGameObjectWithTag("MainCamera");
        body = this.GetComponent<Rigidbody>();
        acc = new Vector3(0f, 0f, acceleration);
        maxDSpeed = new Vector3(0f, 0f, speed);
        maxBSpeed = new Vector3(0f, 0f, maxSpeed);
        body.velocity = maxDSpeed;
        camPos = cardboardSet.transform.position;
        timePassed = 0f;

        audio = GetComponent<AudioSource>();
        audio.clip = Microphone.Start(null, true, 10, 44100);
    }