protected virtual void PredictUnconstraintMotion(float timeStep)
        {
            BulletGlobals.StartProfile("predictUnconstraintMotion");
            int length = m_nonStaticRigidBodies.Count;

#if DEBUG
            if (BulletGlobals.g_streamWriter != null && BulletGlobals.debugDiscreteDynamicsWorld)
            {
                BulletGlobals.g_streamWriter.WriteLine("PredictUnconstraintMotion [{0}][{1}]", length, timeStep);
            }
#endif

            //for (int i = 0; i < length;i++)
            for (int i = 0; i < m_nonStaticRigidBodies.Count; i++)
            {
                RigidBody body = m_nonStaticRigidBodies[i];
                if (!body.IsStaticOrKinematicObject())
                {
                    body.IntegrateVelocities(timeStep);
                    //dampingF
                    body.ApplyDamping(timeStep);
                    IndexedMatrix temp;
                    body.PredictIntegratedTransform(timeStep, out temp);
                    body.SetInterpolationWorldTransform(ref temp);
                }
            }
            BulletGlobals.StopProfile();
        }
Example #2
0
        protected virtual void PredictUnconstraintMotion(float timeStep)
        {
            BulletGlobals.StartProfile("predictUnconstraintMotion");
            int length = m_nonStaticRigidBodies.Count;

            if (BulletGlobals.g_streamWriter != null && BulletGlobals.debugDiscreteDynamicsWorld)
            {
                BulletGlobals.g_streamWriter.WriteLine("PredictUnconstraintMotion [{0}][{1}]", length, timeStep);
            }

            /* the used parallel lib was never pushed it would also be totally obsolete
             * Parallel.For(3,0, length, delegate(int i)
             *                          {
             *                              RigidBody body = m_nonStaticRigidBodies[i];
             *                              if (!body.IsStaticOrKinematicObject())
             *                              {
             *                                  body.IntegrateVelocities(timeStep);
             *                                  //dampingF
             *                                  body.ApplyDamping(timeStep);
             *                                  IndexedMatrix temp;
             *                                  body.PredictIntegratedTransform(timeStep, out temp);
             *                                  body.SetInterpolationWorldTransform(ref temp);
             *                              }
             *                          });
             */

            //for (int i = 0; i < length;i++)
            for (int i = 0; i < m_nonStaticRigidBodies.Count; i++)
            {
                RigidBody body = m_nonStaticRigidBodies[i];
                if (!body.IsStaticOrKinematicObject())
                {
                    body.IntegrateVelocities(timeStep);
                    //dampingF
                    body.ApplyDamping(timeStep);
                    IndexedMatrix temp;
                    body.PredictIntegratedTransform(timeStep, out temp);
                    body.SetInterpolationWorldTransform(ref temp);
                }
            }
            BulletGlobals.StopProfile();
        }
 protected void PredictUnconstraintMotion(float timeStep)
 {
     foreach (CollisionObject colObj in m_collisionObjects)
     {
         RigidBody body = RigidBody.Upcast(colObj);
         if (body != null)
         {
             if (!body.IsStaticObject())
             {
                 if (body.IsActive())
                 {
                     body.ApplyGravity();
                     body.IntegrateVelocities(timeStep);
                     body.ApplyDamping(timeStep);
                     IndexedMatrix temp = body.GetInterpolationWorldTransform();
                     body.PredictIntegratedTransform(timeStep, out temp);
                     body.SetInterpolationWorldTransform(ref temp);
                 }
             }
         }
     }
 }