Ejemplo n.º 1
0
        public void SimulateStep(float stepTime)
        {
            foreach (ObiActor actor in actors)
            {
                actor.OnSolverStepBegin();
            }

            // Trigger event right after actors have fixed their particles in OnSolverStepBegin.
            if (OnFixedParticlesUpdated != null)
            {
                OnFixedParticlesUpdated(this, null);
            }

            // Update all collider and rigidbody information, so that the solver works with up-to-date stuff.
            // This is only actually done for the first solver that calls it this step.
            if (colliderGroup != null)
            {
                colliderGroup.UpdateBodiesInfo(this);
            }

            ObiArbiter.FrameStart();

            // Update the solver (this is internally split in tasks so multiple solvers can be updated in parallel)
            Oni.UpdateSolver(oniSolver, stepTime);

            // Wait here for all other solvers to finish, if we are the last solver to call this.
            ObiArbiter.WaitForAllSolvers();
        }
        public void SimulateStep(float stepTime)
        {
            Oni.ClearDiffuseParticles(oniSolver);

            if (OnStepBegin != null)
            {
                OnStepBegin(this, null);
            }

            foreach (ObiActor actor in actors)
            {
                actor.OnSolverStepBegin();
            }

            // Update Oni skeletal mesh skinning after updating animators:
            Oni.UpdateSkeletalAnimation(oniSolver);

            // Trigger event right after actors have fixed their particles in OnSolverStepBegin.
            if (OnFixedParticlesUpdated != null)
            {
                OnFixedParticlesUpdated(this, null);
            }

            ObiArbiter.FrameStart();

            // Update the solver (this is internally split in tasks so multiple solvers can be updated in parallel)
            Oni.UpdateSolver(oniSolver, stepTime);

            // Wait here for all other solvers to finish, if we are the last solver to call this.
            ObiArbiter.WaitForAllSolvers();
        }
Ejemplo n.º 3
0
 void OnDisable()
 {
     if (!Application.isPlaying)     //only in editor.
     {
         Teardown();
     }
     StopCoroutine("RunLateFixedUpdate");
     ObiArbiter.UnregisterSolver(this);
 }
Ejemplo n.º 4
0
 void OnEnable()
 {
     if (!Application.isPlaying)     //only in editor.
     {
         Initialize();
     }
     StartCoroutine("RunLateFixedUpdate");
     ObiArbiter.RegisterSolver(this);
 }
Ejemplo n.º 5
0
        public void SimulateStep(float stepTime)
        {
            if (IsUpdating)
            {
                Oni.ClearDiffuseParticles(oniSolver);

                if (OnStepBegin != null)
                {
                    OnStepBegin(this, null);
                }

                foreach (ObiActor actor in actors)
                {
                    actor.OnSolverStepBegin();
                }

                // Update Oni skeletal mesh skinning after updating animators:
                Oni.UpdateSkeletalAnimation(oniSolver);

                // Trigger event right after actors have fixed their particles in OnSolverStepBegin.
                if (OnFixedParticlesUpdated != null)
                {
                    OnFixedParticlesUpdated(this, null);
                }

                ObiArbiter.StepStart();

                // Update the solver (this is internally split in tasks so multiple solvers can be updated in parallel)
                Oni.UpdateSolver(oniSolver, substeps, stepTime / (float)substeps);

                // Wait here for all other solvers to finish, if we are the last solver to call this.
                ObiArbiter.WaitForAllSolvers();
            }

            // at the end of every physics step, grab the solver's transform:
            lastTransform = transform.localToWorldMatrix;
        }