Ejemplo n.º 1
0
        public override void OnDisable()
        {
            base.OnDisable();

            if (skinnedMeshRenderer != null)
            {
                skinnedMeshRenderer.sharedMesh = sharedMesh;
            }

            if (animatorController != null)
            {
                animatorController.ResumeAutonomousUpdate();
            }
        }
Ejemplo n.º 2
0
        /**
         * In the case of skinned cloth, we need to tell the animator controller to update the skeletal animation,
         * then grab the skinned vertex positions prior to starting the simulation steps for this frame.
         */
        public override void OnSolverStepBegin()
        {
            if (skinnedMeshRenderer == null)
            {
                // regular on step begin: transform fixed particles.
                base.OnSolverStepBegin();
            }
            else
            {
                // manually update animator (before particle physics):
                if (animatorController != null)
                {
                    if (solver.simulationOrder != ObiSolver.SimulationOrder.LateUpdate)
                    {
                        animatorController.UpdateAnimation();
                    }
                    else
                    {
                        animatorController.ResumeAutonomousUpdate();
                    }
                }

                // apply world space velocity:
                ApplyWorldSpaceVelocity();

                // grab skeleton bone transforms:
                GrabSkeletonBones();
            }
        }