Example #1
0
        public void AllSolversStepEnd()
        {
            // Apply modified rigidbody velocities and torques back:
            // This is only actually done for the first solver that calls it at the end of this step.
            if (colliderGroup != null)
            {
                colliderGroup.UpdateVelocities();
            }

            // Trigger solver events:
            TriggerCollisionEvents();

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

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

            // Update skeletal animation at the end of each physics step.
            Oni.UpdateSkeletalAnimation(oniSolver);

            lastTransform = transform.localToWorldMatrix;
        }
Example #2
0
        public void SimulateStep(float stepTime)
        {
            foreach (ObiActor actor in actors)
            {
                actor.OnSolverStepBegin();
            }

            // Update all collider and rigidbody information, so that the solver works with up-to-date stuff:
            if (colliderGroup != null)
            {
                colliderGroup.UpdateBodiesInfo();
            }

            // Update the solver:
            Oni.UpdateSolver(oniSolver, stepTime);

            // Apply modified rigidbody velocities and torques properties back:
            if (colliderGroup != null)
            {
                colliderGroup.UpdateVelocities();
            }

            TriggerCollisionEvents();

            foreach (ObiActor actor in actors)
            {
                actor.OnSolverStepEnd();
            }
        }
Example #3
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:
            if (colliderGroup != null)
            {
                colliderGroup.UpdateBodiesInfo();
            }

            // Update the solver:
            Oni.UpdateSolver(oniSolver, stepTime);

            // Apply modified rigidbody velocities and torques back:
            if (colliderGroup != null)
            {
                colliderGroup.UpdateVelocities();
            }

            // Trigger solver events:
            TriggerCollisionEvents();

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