Exemple #1
0
 // Integrate the world's motions forward by the given time step.
 public static void Integrate(NativeArray <MotionData> motionDatas, NativeArray <MotionVelocity> motionVelocities, float timeStep)
 {
     for (int i = 0; i < motionDatas.Length; i++)
     {
         ParallelIntegrateMotionsJob.ExecuteImpl(i, motionDatas, motionVelocities, timeStep);
     }
 }
Exemple #2
0
        internal static JobHandle ScheduleIntegrateJobs(ref PhysicsWorld physicsWorld, JobHandle inputDeps, int threadCountHint = 0)
        {
            var job = new ParallelIntegrateMotionsJob
            {
                BodyMotionData     = physicsWorld.BodyMotionData,
                BodyMotionVelocity = physicsWorld.BodyMotionVelocity,
                TimeStep           = physicsWorld.TimeStep,
            };

            return(job.Schedule(physicsWorld.DynamicsWorld.BodyMotionCount, 64, inputDeps));
        }
Exemple #3
0
 // Schedule a job to integrate the world's motions forward by the given time step.
 internal static JobHandle ScheduleIntegrateJobs(ref DynamicsWorld world, float timeStep, JobHandle inputDeps, int threadCountHint = 0)
 {
     if (threadCountHint <= 0)
     {
         var job = new IntegrateMotionsJob
         {
             MotionDatas      = world.MotionDatas,
             MotionVelocities = world.MotionVelocities,
             TimeStep         = timeStep
         };
         return(job.Schedule(inputDeps));
     }
     else
     {
         var job = new ParallelIntegrateMotionsJob
         {
             MotionDatas      = world.MotionDatas,
             MotionVelocities = world.MotionVelocities,
             TimeStep         = timeStep
         };
         return(job.Schedule(world.NumMotions, 64, inputDeps));
     }
 }
Exemple #4
0
 // Schedule a job to integrate the world's motions forward by the given time step.
 internal static JobHandle ScheduleIntegrateJobs(ref DynamicsWorld world, sfloat timeStep, JobHandle inputDeps, bool multiThreaded = true)
 {
     if (!multiThreaded)
     {
         var job = new IntegrateMotionsJob
         {
             MotionDatas      = world.MotionDatas,
             MotionVelocities = world.MotionVelocities,
             TimeStep         = timeStep
         };
         return(job.Schedule(inputDeps));
     }
     else
     {
         var job = new ParallelIntegrateMotionsJob
         {
             MotionDatas      = world.MotionDatas,
             MotionVelocities = world.MotionVelocities,
             TimeStep         = timeStep
         };
         return(job.Schedule(world.NumMotions, 64, inputDeps));
     }
 }