Ejemplo n.º 1
0
        private void SetDirtySolversAffectedByTransform(Transform transform)
        {
            foreach (Solver2D solver in m_IKSolvers)
            {
                if (solver.isValid)
                {
                    for (int i = 0; i < solver.chainCount; ++i)
                    {
                        var chain = solver.GetChain(i);

                        if (chain.effector == null)
                        {
                            continue;
                        }

                        if (!(IKUtility.IsDescendentOf(chain.effector, transform) && IKUtility.IsDescendentOf(chain.rootTransform, transform)) &&
                            (chain.effector == transform || IKUtility.IsDescendentOf(chain.effector, transform) || IKUtility.IsDescendentOf(chain.target, transform)))
                        {
                            SetSolverDirty(solver);
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void SetDirtyUnderHierarchy(Transform hierarchyRoot)
        {
            if (hierarchyRoot == null)
            {
                return;
            }

            foreach (Solver2D solver in m_IKSolvers)
            {
                if (solver.isValid)
                {
                    for (int i = 0; i < solver.chainCount; ++i)
                    {
                        var chain = solver.GetChain(i);

                        if (chain.effector == null)
                        {
                            continue;
                        }

                        if (hierarchyRoot == chain.effector ||
                            IKUtility.IsDescendentOf(chain.effector, hierarchyRoot) ||
                            IKUtility.IsDescendentOf(chain.target, hierarchyRoot))
                        {
                            SetSolverDirty(solver);
                            break;
                        }
                    }
                }
            }
        }
        public void RootGO_IsNotDescendentOfChildGO()
        {
            var result = IKUtility.IsDescendentOf(rootGO.transform, childGO.transform);

            Assert.AreEqual(false, result);
        }
        public void GrandChildGO_IsNotDescendentOfOtherChildGO()
        {
            var result = IKUtility.IsDescendentOf(grandChildGO.transform, otherChildGO.transform);

            Assert.AreEqual(false, result);
        }
        public void OtherChildGO_IsDescendentOfOtherGO()
        {
            var result = IKUtility.IsDescendentOf(otherChildGO.transform, otherGO.transform);

            Assert.AreEqual(true, result);
        }
        public void GrandChildGO_IsDescendentOfRootGO()
        {
            var result = IKUtility.IsDescendentOf(grandChildGO.transform, rootGO.transform);

            Assert.AreEqual(true, result);
        }