示例#1
0
    // Use this for initialization
    void Start()
    {
        manager = this.gameObject.GetComponent <LeapManager> ();
        Debug.Log(this.ToString() + manager.ToString());
        //Create finger bones
        finger_bones = new GameObject[NUM_FINGERS, NUM_BONES];

        for (int i = 0; i < NUM_FINGERS; i += 1)
        {
            for (int g = 0; g < NUM_BONES; g += 1)
            {
                //Debug.Log ("Creating Sphere");

                //Insert prefab fingerbone in spheres array
                //finger_bones [i, g] = Instantiate(FingerBone, new Vector3(5,20,190), Quaternion.Euler(0,0,0)) as GameObject;
                //finger_bones [i, g].GetComponent<Rigidbody> ().MovePosition (new Vector3 (5, 1, 190));
                finger_bones [i, g] = Instantiate(FingerBone) as GameObject;
                //finger_bones [i, g].GetComponent<Rigidbody> ().MovePosition (new Vector3 (5, 1, 190));

                //Change scale of fingerbone
                finger_bones[i, g].GetComponent <BoneManager>().scale    = 0.2f * fingerBoneScale;
                finger_bones[i, g].GetComponent <BoneManager>().boneMass = boneMass;


                finger_bones[i, g].GetComponent <BoneManager>().targetPosition.y = 200;

                //finger_bones[i,g].transform.position = new ;
                //spheres[i, g].transform.localScale = new Vector3 (scale, scale, scale);
            }
        }

        //Create palm bone
        palm_bone = Instantiate(FingerBone, new Vector3(5, 1, -130), Quaternion.Euler(0, 0, 0)) as GameObject;
        palm_bone.GetComponent <Rigidbody> ().MovePosition(new Vector3(5, 1, -130));
        palm_bone.GetComponent <BoneManager> ().scale    = 0.4f * fingerBoneScale;
        palm_bone.GetComponent <BoneManager> ().boneMass = boneMass;
    }