public void SimulateStep(float stepTime)
        {
            if (IsUpdating)
            {
                UpdateColliders();

                Oni.ClearDiffuseParticles(oniSolver);

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

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

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

                // 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:
                WaitForAllSolvers();
            }
        }
        public void SimulateStep(float stepTime)
        {
            UpdateTransformFrame(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);
                }

                // 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:
                WaitForAllSolvers();
            }
        }
Beispiel #3
0
        void LateFixedUpdate()//FixedUpdate()
        {
            if (IsUpdating)
            {
                Oni.ClearDiffuseParticles(oniSolver);

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

                SimulateStep(Time.fixedDeltaTime);
            }
        }
Beispiel #4
0
        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);
            }

            // 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();
        }
Beispiel #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;
        }