Esempio n. 1
0
        protected override void Start()
        {
            base.Start();

            QuickIKManager ikManager = GetComponent <QuickIKManager>();
            //ikManager._ikHintMaskUpdate &= ~(1 << (int)IKLimbBones.LeftFoot);
            //ikManager._ikHintMaskUpdate &= ~(1 << (int)IKLimbBones.RightFoot);
        }
Esempio n. 2
0
        // Use this for initialization
        public virtual void Init(QuickIKManager ikManager)
        {
            if (ikManager == null)
            {
                return;
            }

            _ikManager = ikManager;

            _ikTargets = new Transform[6];
            _ikTargets[(int)IkTarget.LeftHand]  = _ikManager.GetIKSolver(IKBone.LeftHand)._targetLimb;
            _ikTargets[(int)IkTarget.RightHand] = _ikManager.GetIKSolver(IKBone.RightHand)._targetLimb;
            _ikTargets[(int)IkTarget.LeftFoot]  = _ikManager.GetIKSolver(IKBone.LeftFoot)._targetLimb;
            _ikTargets[(int)IkTarget.RightFoot] = _ikManager.GetIKSolver(IKBone.RightFoot)._targetLimb;
            _ikTargets[(int)IkTarget.Head]      = _ikManager.GetIKSolver(IKBone.Head)._targetLimb;
            _ikTargets[(int)IkTarget.Hips]      = _ikManager.transform;

            _ikRecord = new QuickIKRecord();

            _init = true;
        }
        private static void DrawIKTargets()
        {
            foreach (QuickIKManagerExecuteInEditMode ikManagerEditor in _ikManagers)
            {
                QuickIKManager ikManager = ikManagerEditor._ikManager;
                if (ikManager && ikManager.gameObject.activeInHierarchy)
                {
                    for (IKBone ikBone = 0; ikBone < IKBone.LastBone; ikBone++)
                    {
                        QuickIKSolver ikSolver = ikManager.GetIKSolver(ikBone);
                        float         size;
                        if (ikBone >= IKBone.Hips && ikBone <= IKBone.RightFoot)
                        {
                            size = 0.05f;
                        }
                        else
                        {
                            size = 0.01f;
                        }

                        Handles.color = new Color(1, 0, 0, 0.5f);
                        if (Handles.Button(ikSolver._targetLimb.position, ikSolver._targetLimb.rotation, size, size, Handles.CubeHandleCap))
                        {
                            SelectIKTarget(ikSolver._targetLimb, ikSolver, ikBone);
                        }

                        if (ikSolver._targetHint)
                        {
                            Handles.color = new Color(0, 1, 0, 0.5f);
                            if (Handles.Button(ikSolver._targetHint.position, ikSolver._targetHint.rotation, size, size, Handles.SphereHandleCap))
                            {
                                SelectIKTarget(ikSolver._targetHint, ikSolver, ikBone);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        protected virtual void Awake()
        {
            SavePose();

            _ikManager = GetComponentInParent <QuickIKManager>();
        }
        protected virtual void OnEnable()
        {
            _ikManager = (QuickIKManager)target;

            //SceneView.duringSceneGui += UpdateDebug;
        }