Exemple #1
0
        void Start()
        {
            if (Controller != null && Tracker != null)
            {
                //VRObjectMimic controllerMimic = VRMimic.Instance.FindMimicOfObject(Controller);
                VRObjectMimic controllerMimic = VRMimic.Instance.AddTrackedObject(Controller, controllerMimicType);

                if (controllerMimic == null)
                {
                    //Setup controller tracker
                }
                else
                {
                    controllerMimic.Init(Controller);
                }

                VRObjectMimic mimic = VRMimic.Instance.AddTrackedObject(Tracker);
                if (mimic == null)
                {
                }
                else
                {
                    mimic.Init(Tracker);
                }

                ArmMimic newArm = VRMimic.Instance.ActiveBodyMimic.CreateArm(MySide, mimic, controllerMimic);
                Debug.Log("Created new arm.\n\t[Click to select it]", newArm);
            }
        }
        public ArmMimic CreateArm(ArmMimic.ArmSide WhichSide, VRObjectMimic Tracker, VRObjectMimic Controller)
        {
            //Create an Arm Prefab
            ArmMimic newArm = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("Arm Mimic Prefab")).GetComponent <ArmMimic>();

            newArm.transform.SetParent(transform);

            //Initialize the arm prefab (handing in the side and connector points)
            newArm.Initialize(WhichSide, GetShoulder(WhichSide), Tracker, Controller);

            //Keep track of this as our Left/Right arm?
            AttachArmToOurBody(WhichSide, newArm);
            return(newArm);
        }
 public void AttachArmToOurBody(ArmMimic.ArmSide WhichSide, ArmMimic Arm)
 {
     if (WhichSide == ArmMimic.ArmSide.Left)
     {
         LeftArm = Arm;
         LeftArm.transform.SetParent(LeftShoulder.transform);
         LeftArm.transform.localPosition = Arm.transform.right * -.5f;
         LeftArm.MirrorKeyArmElements();
     }
     else
     {
         RightArm = Arm;
         RightArm.transform.SetParent(RightShoulder.transform);
         RightArm.transform.localPosition = Arm.transform.right * .5f;
     }
 }