bool SpawnInstance(NeuronActor actor)
    {
        if (actor == null || !ValidatePrefab())
        {
            return(false);
        }

        NeuronAnimatorInstance instance = null;

        if (reservedInstances.Count == 0)
        {
            GameObject obj = GameObject.Instantiate(replicaPrefab, Vector3.zero, Quaternion.identity) as GameObject;
            instance = obj.GetComponent <NeuronAnimatorInstance>();
            Debug.Log(string.Format("[NeuronInstancesManager] Bound instance {0} actor {1}", obj.name, actor.guid.ToString("N")));
            instance.SetBoundActor(actor);
        }
        else
        {
            instance = reservedInstances[reservedInstances.Count - 1];
            reservedInstances.RemoveAt(reservedInstances.Count - 1);
            Debug.Log(string.Format("[NeuronInstancesManager] Bound instance {0} actor {1}", instance.gameObject.name, actor.guid.ToString("N")));
            instance.SetBoundActor(actor);
        }

        if (instance != null)
        {
            instances.Add(actor, instance);
        }

        return(true);
    }
예제 #2
0
    private string GenerateNeuronMasterInfo(int instanceIndex)
    {
        if (instanceIndex >= numOfInstances)
        {
            return(string.Empty);
        }

        NeuronAnimatorInstance instance = GetInstances()[instanceIndex];

        if (instance == null)
        {
            return(string.Empty);
        }

        string      line  = string.Empty;
        NeuronActor actor = instance.GetActor();

        if (actor != null)
        {
            line += string.Format("Data version: {0}.{1}.{2}.{3}\n", actor.version.Major, actor.version.Minor, actor.version.Revision, actor.version.BuildNumb);
            line += string.Format("Actor name: {0}\n", actor.name);
            line += string.Format("Actor index: {0}\n", actor.index);
            line += string.Format("With displacement: {0}\n", actor.withDisplacement);
            line += string.Format("With reference: {0}\n", actor.withReference);
            line += string.Format("Number of connections: {0}\n", NeuronConnection.numOfSources);
            line += string.Format("Number of active actors: {0}\n", actor.owner.numOfActiveActors);
            line += string.Format("Number of suspended actors: {0}\n", actor.owner.numOfSuspendedActors);
        }
        return(line);
    }
    void Update()
    {
        if (animator != null && source != null)
        {
            // Here we use NeuronAnimatorMaster to apply our motion to the animator component.
            Vector3[] positionOffsets = new Vector3[(int)HumanBodyBones.LastBone];
            Vector3[] rotationOffsets = new Vector3[(int)HumanBodyBones.LastBone];
            NeuronAnimatorInstance.ApplyMotion(actor, animator, positionOffsets, rotationOffsets);

            // If you want to do some customization and set bones transforms in your own way, use the following methods.

            // Update Hips
            // Transform hips_t = animator.GetBoneTransform( HumanBodyBones.Hips );
            // hips_t.position = actor.GetReceivedPosition( NeuronBones.Hips );
            // hips_t.root = actor.GetReceivedRotation( NeuronBones.Hips );

            // Update RightUpLeg
            // Transform rightUpperLeg_t = animator.GetBoneTransform( HumanBodyBones.RightUpperLeg );
            // rightUpperLeg_t.position = actor.GetReceivedPosition( NeuronBones.RightUpLeg );
            // rightUpperLeg_t.rotation = actor.GetReceivedRotation( NeuronBones.RightUpLeg );

            // ... and so on for the other bones.

            // In this example we traverse the HumanBodyBones to get transforms components referenced in the animator component.
            // If you don't want to use the Animator component, you can assign the bones transforms references in your own way.
            // You can check NeuronHelper.Bind() to see how we bind bones using a naming convention with prefixs.
            // Just keep in mind that the Neuron default model might be rigged differently then yours.
            // For further info on this subject check the included documentation.
        }
    }
예제 #4
0
 private void ToggleTrailRenderers()
 {
     NeuronAnimatorInstance[] instances = GetInstances();
     for (int i = 0; i < instances.Length; ++i)
     {
         NeuronAnimatorInstance instance = instances[i];
         ToggleTrailRenderers(instance);
     }
 }
예제 #5
0
 private void SetCameraTargets(int instanceIndex)
 {
     if (instanceIndex < numOfInstances)
     {
         NeuronAnimatorInstance instance = GetInstances()[instanceIndex];
         MainCamera.GetComponent <CameraController> ().TargetToMoveTo     = instance.boundAnimator.GetBoneTransform(HumanBodyBones.Hips);
         SideCameras[0].GetComponent <CameraController> ().TargetToMoveTo = instance.boundAnimator.GetBoneTransform(HumanBodyBones.RightIndexProximal);
         SideCameras[1].GetComponent <CameraController> ().TargetToMoveTo = instance.boundAnimator.GetBoneTransform(HumanBodyBones.LeftIndexProximal);
         VerticalGrid.GetComponent <GridFollowActor>().Target             = instance.boundAnimator.GetBoneTransform(HumanBodyBones.Hips);
     }
 }
예제 #6
0
        public bool Init(Animator animator, Animator animatorOverride)
        {
            if (animator == null)
            {
                Debug.LogError("[NeuronAnimatorPhysicalReference] Invalid Animator");
                return(false);
            }

            // check if there is enough Rigidbody Component on the bones,
            // if not return false to prevent init reference_object
            if (!CheckRigidbodies(animator))
            {
                Debug.LogError(string.Format(
                                   "[NeuronAnimatorPhysicalReference] Trying to use physics update but no Rigidbody Component in Actor \"{0}\". Did you forget to add Rigidbody Component?",
                                   animator.gameObject.name), animator);
                return(false);
            }

            if (animatorOverride == null)
            {
                // duplicate bound object as reference object,
                // we only use this reference object's transforms to get world transforms
                referenceObject      = (GameObject)GameObject.Instantiate(animator.gameObject, animator.gameObject.transform.position, animator.gameObject.transform.rotation);
                referenceObject.name = string.Format("{0} (neuron reference)", animator.gameObject.name);
                referenceAnimator    = referenceObject.GetComponent <Animator>();

                NeuronAnimatorInstance referenceInstance = referenceObject.GetComponent <NeuronAnimatorInstance>();
                if (referenceInstance != null)
                {
                    //referenceInstance.physicalUpdate = false;
                    referenceInstance.motionUpdateMethod = Neuron.UpdateMethod.Normal;
                }

                // remove all unnecessary components, this will prevent rendering and any unexpected behaviour from custom scripts
                Component[] components = referenceObject.GetComponentsInChildren <Component>();
                for (int i = 0; i < components.Length; ++i)
                {
                    if (components[i].GetType() != typeof(Transform) &&
                        components[i].GetType() != typeof(Animator) &&
                        components[i].GetType() != typeof(NeuronAnimatorInstance))
                    {
                        GameObject.DestroyImmediate(components[i]);
                    }
                }
            }
            else
            {
                referenceAnimator = animatorOverride;
            }
            return(true);
        }
예제 #7
0
    void FixedUpdate()
    {
        if (currentGrab != null && currentGrab.obj != null)
        {
            GameObject obj = currentGrab.obj;

            // calculate delta position and delta rotation between fixed updates
            Quaternion dAng = currentAnchor.rotation * Quaternion.Inverse(obj.transform.rotation);
            Vector3    dPos = currentAnchor.position - obj.transform.position;
            float      angle;
            Vector3    axis;
            dAng.ToAngleAxis(out angle, out axis);

            if (angle > 180.0f)
            {
                angle -= 360.0f;
            }

            // estimate next position and rotation and set to rigidbody, using approach from NewtonVR
            if (angle != 0)
            {
                Rigidbody rb             = obj.GetComponent <Rigidbody>();
                Vector3   velocityTarget = dPos * velocityMagic * Time.fixedDeltaTime;
                Vector3   angularTarget  = (Time.fixedDeltaTime * angle * axis) * angularVelocityMagic;

                ApplyVelocity(rb, velocityTarget, angularTarget);

                velocityHistory.Add(velocityTarget);
                angularVelocityHistory.Add(angularTarget);
                if (positionSourceTransform == null)
                {
                    NeuronAnimatorInstance neuron = rightHandAnchor.GetComponentInParent <NeuronAnimatorInstance>();
                    positionSourceTransform = neuron.physicalReference.GetReferenceAnimator().GetBoneTransform(HumanBodyBones.RightHand);
                }
                positionHistory.Add(positionSourceTransform.position);

                if (velocityHistory.Count > cachedFrameCount)
                {
                    velocityHistory.RemoveAt(0);
                    angularVelocityHistory.RemoveAt(0);
                    positionHistory.RemoveAt(0);
                }
            }
        }

        if (lastMaxVelocity.magnitude > 0)
        {
            Debug.DrawLine(lastMaxVelocityPosition, lastMaxVelocityPosition + lastMaxVelocity, Color.red);
        }
    }
    public void OnDisconnect(NeuronSource source)
    {
        NeuronActor[] activeActors = source.GetActiveActors();

        for (int i = 0; i < activeActors.Length; ++i)
        {
            NeuronActor            actor    = activeActors[i];
            NeuronAnimatorInstance instance = null;
            instances.TryGetValue(actor, out instance);
            if (instance != null)
            {
                instancesToDestroy.Add(instance);
            }
        }
    }
예제 #9
0
    private string GenerateNeuronMasterInfo(int instanceIndex)
    {
        if (instanceIndex >= numOfInstances)
        {
            return(string.Empty);
        }

        NeuronAnimatorInstance instance = GetInstances()[instanceIndex];

        if (instance == null)
        {
            return(string.Empty);
        }

        string      line  = string.Empty;
        NeuronActor actor = instance.GetActor();

        if (actor != null)
        {
            line += string.Format("Data version: {0}.{1}.{2}.{3}\n", actor.version.Major, actor.version.Minor, actor.version.Revision, actor.version.BuildNumb);
            line += string.Format("Actor name: {0}\n", actor.name);
            line += string.Format("Actor index: {0}\n", actor.index);
            line += string.Format("With displacement: {0}\n", actor.withDisplacement);
            line += string.Format("With reference: {0}\n", actor.withReference);
            line += string.Format("Data frequency: {0}\n", actor.frequency);

            string temp = string.Empty;
            if (actor.combinationMode == NeuronDataReaderWraper.SensorCombinationModes.SC_ArmOnly)
            {
                temp = "arm only";
            }
            else if (actor.combinationMode == NeuronDataReaderWraper.SensorCombinationModes.SC_UpperBody)
            {
                temp = "upper body";
            }
            else if (actor.combinationMode == NeuronDataReaderWraper.SensorCombinationModes.SC_FullBody)
            {
                temp = "full body";
            }

            line += string.Format("Combination mode: {0}\n", temp);
            line += string.Format("Number of connections: {0}\n", NeuronConnection.numOfSources);
            line += string.Format("Number of active actors: {0}\n", actor.owner.numOfActiveActors);
            line += string.Format("Number of suspended actors: {0}\n", actor.owner.numOfSuspendedActors);
        }
        return(line);
    }
    void OnSuspendActor(NeuronActor actor)
    {
        NeuronAnimatorInstance instance = null;

        instances.TryGetValue(actor, out instance);
        if (instance != null)
        {
            if (instances.Count > numOfReserveInstances)
            {
                instancesToDestroy.Add(instance);
            }
            else
            {
                reservedInstances.Add(instance);
                instances.Remove(actor);
            }
        }
    }
예제 #11
0
    private void ToggleTrailRenderers(NeuronAnimatorInstance instance)
    {
        TrailRenderer[] trailRenderes = instance.gameObject.GetComponentsInChildren <TrailRenderer>();

        foreach (TrailRenderer t in trailRenderes)
        {
            if (_currentLineMode == 0)               // all off
            {
                t.enabled = false;
            }

            if (_currentLineMode == 1)               // fingers only
            {
                if (t.name == "Robot_RightHand" ||
                    t.name == "Robot_LeftHand" ||
                    t.name == "Robot_RightFoot" ||
                    t.name == "Robot_LeftFoot")
                {
                    t.enabled = false;
                }
                else
                {
                    t.enabled = true;
                }
            }

            if (_currentLineMode == 2)               // hands and feet only
            {
                if (t.name == "Robot_RightHand" ||
                    t.name == "Robot_LeftHand" ||
                    t.name == "Robot_RightFoot" ||
                    t.name == "Robot_LeftFoot")
                {
                    t.enabled = true;
                }
                else
                {
                    t.enabled = false;
                }
            }
        }
    }
예제 #12
0
    void OnSelectionChange()
    {
        List <GameObject> new_objects  = new List <GameObject>();
        List <string>     new_prefixes = new List <string>();

        for (int i = 0; i < Selection.transforms.Length; ++i)
        {
            Transform t = Selection.transforms[i];
            NeuronAnimatorInstance   animator_driver  = t.GetComponent <NeuronAnimatorInstance>();
            NeuronTransformsInstance transform_driver = t.GetComponent <NeuronTransformsInstance>();

            if (animator_driver != null && t.GetComponent <Animator>() != null || transform_driver != null)
            {
                new_objects.Add(t.gameObject);
                new_prefixes.Add(transform_driver != null ? default_prefix : null);
            }
        }

        if (new_objects.Count > 0)
        {
            objects  = new_objects;
            prefixes = new_prefixes;
        }
    }
	void KillInstance( NeuronAnimatorInstance instance )
	{
		instances.Remove( instance.GetActor() );
		GameObject.Destroy( instance.gameObject );
	}
 void KillInstance(NeuronAnimatorInstance instance)
 {
     instances.Remove(instance.GetActor());
     GameObject.Destroy(instance.gameObject);
 }
 public NeuronAnimatorInstance[] GetInstances()
 {
     NeuronAnimatorInstance[] ret = new NeuronAnimatorInstance[instances.Count];
     instances.Values.CopyTo(ret, 0);
     return(ret);
 }
	public NeuronAnimatorInstance[] GetInstances()
	{
		NeuronAnimatorInstance[] ret = new NeuronAnimatorInstance[instances.Count];
		instances.Values.CopyTo( ret, 0 );
		return ret;
	}
예제 #17
0
    void FixedUpdate()
    {
        if (!bInitDevice)
        {
            if (bCheckedDevices)
            {
                bInitDevice = true;
                switch (eAutoMotionCaptureDevicesSelecter)
                {
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_1:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_2:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_3:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_4:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_5:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_6:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_7:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_8:
                    int iDeviceSelect = eAutoMotionCaptureDevicesSelecter - EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_1;
                    int iSelect       = 0;
                    foreach (SNeuronConnection sNeuronConnection in sNeuronConnections)
                    {
                        if (iDeviceSelect == iSelect)
                        {
                            GameObject goTopPerceptionNeuron = null;
                            if (sNeuronConnection.goAttach == null)
                            {
                                goTopPerceptionNeuron = Instantiate(sNeuronConnection.prefabDeviceJoints, Vector3.zero, Quaternion.identity) as GameObject;
                                sNeuronConnections[iSelect].goAttach          = this.gameObject;
                                goTopPerceptionNeuron.transform.parent        = this.gameObject.transform;
                                goTopPerceptionNeuron.transform.localPosition = sNeuronConnections[iSelect].goAttach.transform.localPosition;
                                goTopPerceptionNeuron.transform.localRotation = sNeuronConnections[iSelect].goAttach.transform.localRotation;
                                goTopPerceptionNeuron.transform.localScale    = sNeuronConnections[iSelect].goAttach.transform.localScale;
                            }
                            else
                            {
                                goTopPerceptionNeuron = Instantiate(sNeuronConnection.prefabDeviceJoints, Vector3.zero, Quaternion.identity) as GameObject;
                                goTopPerceptionNeuron.transform.parent        = sNeuronConnection.goAttach.transform;
                                goTopPerceptionNeuron.transform.localPosition = sNeuronConnection.goAttach.transform.localPosition;
                                goTopPerceptionNeuron.transform.localRotation = sNeuronConnection.goAttach.transform.localRotation;
                                goTopPerceptionNeuron.transform.localScale    = sNeuronConnection.goAttach.transform.localScale;
                            }
                            if (goTopPerceptionNeuron != null)
                            {
                                NeuronAnimatorInstance sNeuronAnimatorInstance = goTopPerceptionNeuron.GetComponent <NeuronAnimatorInstance>();
                                sNeuronAnimatorInstance.address = sNeuronConnection.address;
                                sNeuronAnimatorInstance.port    = sNeuronConnection.port;
                                //sNeuronAnimatorInstance.commandServerPort = sNeuronConnection.commandServerPort;
                                sNeuronAnimatorInstance.socketType       = sNeuronConnection.socketType;
                                sNeuronAnimatorInstance.actorID          = sNeuronConnection.actorID;
                                sNeuronAnimatorInstance.connectToAxis    = true;
                                sNeuronAnimatorInstance.bFixedUpdateMode = bFixedUpdateMode;
                                sNeuronAnimatorInstance.enabled          = true;
                            }
                        }
                        iSelect++;
                    }
                    break;

                case EAutoMotionCaptureDevicesSelecter.eKinect1:
                    if (goKinect1_Attach == null)
                    {
                        GameObject goTopKinect1 = Instantiate(prefabKinect1_DeviceJoints, Vector3.zero, Quaternion.identity) as GameObject;
                        goKinect1_Attach = this.gameObject;
                        goTopKinect1.transform.parent        = goKinect1_Attach.transform;
                        goTopKinect1.transform.localPosition = goKinect1_Attach.transform.localPosition;
                        goTopKinect1.transform.localRotation = goKinect1_Attach.transform.localRotation;
                        goTopKinect1.transform.localScale    = goKinect1_Attach.transform.localScale;
                        Kinect1ModelControllerV2 sKinect1ModelControllerV2 = goTopKinect1.GetComponentInChildren <Kinect1ModelControllerV2>();
                        if (sKinect1ModelControllerV2 != null)
                        {
                            sKinect1ModelControllerV2.sAutoMotionCaptureDevicesSelecter = this;
                            sKinect1ModelControllerV2.sFBXExporterForUnity = sFBXExporterForUnity;
                            sKinect1ModelControllerV2.bFixedUpdateMode     = bFixedUpdateMode;
                            sKinect1ModelControllerV2.iFPS          = iFPS;
                            sKinect1ModelControllerV2.fLerpPosition = fLerpPosition;
                            sKinect1ModelControllerV2.fLerpRotation = fLerpRotation;
                        }
                    }
                    else
                    {
                        GameObject goTopKinect1 = Instantiate(prefabKinect1_DeviceJoints, Vector3.zero, Quaternion.identity) as GameObject;
                        goTopKinect1.transform.parent        = goKinect1_Attach.transform;
                        goTopKinect1.transform.localPosition = goKinect1_Attach.transform.localPosition;
                        goTopKinect1.transform.localRotation = goKinect1_Attach.transform.localRotation;
                        goTopKinect1.transform.localScale    = goKinect1_Attach.transform.localScale;
                        Kinect1ModelControllerV2 sKinect1ModelControllerV2 = goTopKinect1.GetComponentInChildren <Kinect1ModelControllerV2>();
                        if (sKinect1ModelControllerV2 != null)
                        {
                            sKinect1ModelControllerV2.sAutoMotionCaptureDevicesSelecter = this;
                            sKinect1ModelControllerV2.sFBXExporterForUnity = sFBXExporterForUnity;
                            sKinect1ModelControllerV2.bFixedUpdateMode     = bFixedUpdateMode;
                            sKinect1ModelControllerV2.iFPS          = iFPS;
                            sKinect1ModelControllerV2.fLerpPosition = fLerpPosition;
                            sKinect1ModelControllerV2.fLerpRotation = fLerpRotation;
                        }
                    }
                    break;

                case EAutoMotionCaptureDevicesSelecter.eKinect2:
                    if (goKinect2_Attach == null)
                    {
                        GameObject goTopKinect2 = Instantiate(prefabKinect2_DeviceJoints, Vector3.zero, Quaternion.identity) as GameObject;
                        goKinect2_Attach = this.gameObject;
                        goTopKinect2.transform.parent        = goKinect2_Attach.transform;
                        goTopKinect2.transform.localPosition = goKinect2_Attach.transform.localPosition;
                        goTopKinect2.transform.localRotation = goKinect2_Attach.transform.localRotation;
                        goTopKinect2.transform.localScale    = goKinect2_Attach.transform.localScale;
                        Kinect2ModelControllerV2 sKinect2ModelControllerV2 = goTopKinect2.GetComponentInChildren <Kinect2ModelControllerV2>();
                        if (sKinect2ModelControllerV2 != null)
                        {
                            sKinect2ModelControllerV2.sAutoMotionCaptureDevicesSelecter = this;
                            sKinect2ModelControllerV2.sFBXExporterForUnity = sFBXExporterForUnity;
                            sKinect2ModelControllerV2.bFixedUpdateMode     = bFixedUpdateMode;
                            sKinect2ModelControllerV2.iFPS          = iFPS;
                            sKinect2ModelControllerV2.fLerpPosition = fLerpPosition;
                            sKinect2ModelControllerV2.fLerpRotation = fLerpRotation;
                        }
                    }
                    else
                    {
                        GameObject goTopKinect2 = Instantiate(prefabKinect2_DeviceJoints, Vector3.zero, Quaternion.identity) as GameObject;
                        goTopKinect2.transform.parent        = goKinect2_Attach.transform;
                        goTopKinect2.transform.localPosition = goKinect2_Attach.transform.localPosition;
                        goTopKinect2.transform.localRotation = goKinect2_Attach.transform.localRotation;
                        goTopKinect2.transform.localScale    = goKinect2_Attach.transform.localScale;
                        Kinect2ModelControllerV2 sKinect2ModelControllerV2 = goTopKinect2.GetComponentInChildren <Kinect2ModelControllerV2>();
                        if (sKinect2ModelControllerV2 != null)
                        {
                            sKinect2ModelControllerV2.sAutoMotionCaptureDevicesSelecter = this;
                            sKinect2ModelControllerV2.sFBXExporterForUnity = sFBXExporterForUnity;
                            sKinect2ModelControllerV2.bFixedUpdateMode     = bFixedUpdateMode;
                            sKinect2ModelControllerV2.iFPS          = iFPS;
                            sKinect2ModelControllerV2.fLerpPosition = fLerpPosition;
                            sKinect2ModelControllerV2.fLerpRotation = fLerpRotation;
                        }
                    }
                    break;
                }
            }
        }
        else
        {
            if (!bInitTransform)
            {
                bInitTransform = true;
                switch (eAutoMotionCaptureDevicesSelecter)
                {
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_1:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_2:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_3:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_4:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_5:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_6:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_7:
                case EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_8:
                    int iDeviceSelect = eAutoMotionCaptureDevicesSelecter - EAutoMotionCaptureDevicesSelecter.ePerceptionNeuron_1;
                    int iSelect       = 0;
                    foreach (SNeuronConnection sNeuronConnection in sNeuronConnections)
                    {
                        if (iDeviceSelect == iSelect)
                        {
                            if (sNeuronConnection.goAttach != null)
                            {
                                sNeuronConnection.goAttach.transform.localPosition = sNeuronConnection.vecPosition;
                                sNeuronConnection.goAttach.transform.localRotation = Quaternion.Euler(sNeuronConnection.vecRotation);
                                sNeuronConnection.goAttach.transform.localScale    = sNeuronConnection.vecScale;
                            }
                        }
                        iSelect++;
                    }
                    //iInitReadyFrame = 120;
                    bInitMoveTransform = true;
                    break;

                case EAutoMotionCaptureDevicesSelecter.eKinect1:
                    if (goKinect1_Attach != null)
                    {
                        goKinect1_Attach.transform.localPosition = vecKinect1_Position;
                        goKinect1_Attach.transform.localRotation = Quaternion.Euler(vecKinect1_Rotation);
                        goKinect1_Attach.transform.localScale    = vecKinect1_Scale;
                    }
                    //iInitReadyFrame = 120;
                    //bInitMoveTransform = true;
                    break;

                case EAutoMotionCaptureDevicesSelecter.eKinect2:
                    if (goKinect2_Attach != null)
                    {
                        goKinect2_Attach.transform.localPosition = vecKinect2_Position;
                        goKinect2_Attach.transform.localRotation = Quaternion.Euler(vecKinect2_Rotation);
                        goKinect2_Attach.transform.localScale    = vecKinect2_Scale;
                    }
                    //iInitReadyFrame = 120;
                    //bInitMoveTransform = true;
                    break;
                }
            }
            else
            {
                if (!bInitEnableAnimator)
                {
                    if (bInitMoveTransform)
                    {
                        bInitEnableAnimator = true;
                        foreach (GameObject goLiveAnimator in goLiveAnimators)
                        {
                            HumanPoseRetargetLiveAnimator sHumanPoseRetargetLiveAnimator = goLiveAnimator.GetComponent <HumanPoseRetargetLiveAnimator>();
                            if (sHumanPoseRetargetLiveAnimator != null)
                            {
                                sHumanPoseRetargetLiveAnimator.bFixedUpdateMode = bFixedUpdateMode;
                                sHumanPoseRetargetLiveAnimator.iFPS             = iFPS;
                                sHumanPoseRetargetLiveAnimator.fLerpPosition    = fLerpPosition;
                                sHumanPoseRetargetLiveAnimator.fLerpRotation    = fLerpRotation;
                            }
                            HumanBodyBonesLiveAnimator HumanBodyBonesLiveAnimators = goLiveAnimator.GetComponent <HumanBodyBonesLiveAnimator>();
                            if (HumanBodyBonesLiveAnimators != null)
                            {
                                HumanBodyBonesLiveAnimators.bFixedUpdateMode = bFixedUpdateMode;
                                HumanBodyBonesLiveAnimators.iFPS             = iFPS;
                                HumanBodyBonesLiveAnimators.fLerpPosition    = fLerpPosition;
                                HumanBodyBonesLiveAnimators.fLerpRotation    = fLerpRotation;
                            }
                            HumanoidAvatarLiveAnimator sHumanoidAvatarLiveAnimator = goLiveAnimator.GetComponent <HumanoidAvatarLiveAnimator>();
                            if (sHumanoidAvatarLiveAnimator != null)
                            {
                                sHumanoidAvatarLiveAnimator.bFixedUpdateMode      = bFixedUpdateMode;
                                sHumanoidAvatarLiveAnimator.iFPS                  = iFPS;
                                sHumanoidAvatarLiveAnimator.fLerpPosition         = fLerpPosition;
                                sHumanoidAvatarLiveAnimator.fLerpRotation         = fLerpRotation;
                                sHumanoidAvatarLiveAnimator.bInitedEnableAnimator = true;
                            }
                        }
                    }
                }
                else
                {
                    if (iInitReadyFrame >= 0)
                    {
                        iInitReadyFrame--;
                        foreach (GameObject goLiveAnimator in goLiveAnimators)
                        {
                            if (goLiveAnimator != null)
                            {
                                if (goLiveAnimator.activeInHierarchy)
                                {
                                    HumanPoseRetargetLiveAnimator sHumanPoseRetargetLiveAnimator = goLiveAnimator.GetComponent <HumanPoseRetargetLiveAnimator>();
                                    if (sHumanPoseRetargetLiveAnimator != null)
                                    {
                                        if (iInitReadyFrame <= 0)
                                        {
                                            sHumanPoseRetargetLiveAnimator.bInitReady = true;
                                        }
                                    }
                                    HumanoidAvatarLiveAnimator sHumanoidAvatarLiveAnimator = goLiveAnimator.GetComponent <HumanoidAvatarLiveAnimator>();
                                    if (sHumanoidAvatarLiveAnimator != null)
                                    {
                                        if (iInitReadyFrame <= 0)
                                        {
                                            sHumanoidAvatarLiveAnimator.bInitReady = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!bAllInited)
                    {
                        bool bAllInitedCheck = true;
                        foreach (GameObject goLiveAnimator in goLiveAnimators)
                        {
                            if (goLiveAnimator != null)
                            {
                                if (goLiveAnimator.activeInHierarchy)
                                {
                                    HumanPoseRetargetLiveAnimator sHumanPoseRetargetLiveAnimator = goLiveAnimator.GetComponent <HumanPoseRetargetLiveAnimator>();
                                    if (sHumanPoseRetargetLiveAnimator != null)
                                    {
                                        if (sHumanPoseRetargetLiveAnimator.enabled)
                                        {
                                            if (!sHumanPoseRetargetLiveAnimator.bInited)
                                            {
                                                bAllInitedCheck = false;
                                            }
                                        }
                                    }
                                    HumanoidAvatarLiveAnimator sHumanoidAvatarLiveAnimator = goLiveAnimator.GetComponent <HumanoidAvatarLiveAnimator>();
                                    if (sHumanoidAvatarLiveAnimator != null)
                                    {
                                        if (sHumanoidAvatarLiveAnimator.enabled)
                                        {
                                            if (!sHumanoidAvatarLiveAnimator.bInited)
                                            {
                                                bAllInitedCheck = false;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if (bAllInitedCheck)
                        {
                            bAllInited = true;
                            if (sFBXExporterForUnity != null)
                            {
                                sFBXExporterForUnity.bOutAnimation = true;
                            }
                        }
                    }
                }
            }
        }
    }