// Schedule some jobs to build Jacobians from the contacts stored in the simulation context public static JobHandle ScheduleBuildContactJacobiansJobs(ref DynamicsWorld world, float timeStep, ref Simulation.Context context, JobHandle inputDeps) { var buildJob = new BuildContactJacobiansJob { ContactReader = context.Contacts, JointJacobianReader = context.JointJacobians, JacobianWriter = context.Jacobians, TimeStep = timeStep, MotionDatas = world.MotionDatas, MotionVelocities = world.MotionVelocities }; int numWorkItems = context.SolverSchedulerInfo.NumWorkItems; JobHandle handle = buildJob.Schedule(numWorkItems, 1, inputDeps); context.DisposeContacts = context.Contacts.ScheduleDispose(handle); return(handle); }
// Schedule some jobs to build Jacobians from the contacts stored in the simulation context internal static JobHandle ScheduleBuildContactJacobiansJobs(ref DynamicsWorld world, float timeStep, float gravityAcceleration, ref Simulation.Context context, JobHandle inputDeps) { var buildJob = new BuildContactJacobiansJob { ContactReader = context.Contacts.AsReader(), JointJacobianReader = context.JointJacobians.AsReader(), JacobianWriter = context.Jacobians.AsWriter(), TimeStep = timeStep, InvTimeStep = timeStep > 0.0f ? 1.0f / timeStep : 0.0f, GravityAcceleration = gravityAcceleration, MotionDatas = world.MotionDatas, MotionVelocities = world.MotionVelocities }; JobHandle handle = buildJob.ScheduleUnsafeIndex0(context.SolverSchedulerInfo.NumWorkItems, 1, inputDeps); context.DisposeContacts = context.Contacts.Dispose(handle); return(handle); }