I am using the user input to move a corkscrew joint. This worked in 1.53; I'm not sure it works with 2.0 - a lot other bugs popped first and I haven't been able to properly test this part.

I haven't looked up whether joint specific functions like NewtonCorkscrewGetJointVeloc are the same in 2.0 or if the callback is still passed a NewtonHingeSliderUpdateDesc argument.

Initialization of the corkscrew joint elements:
Code:
thing = ent_create("model.mdl", vector(0, 1, 1), NULL);
nthing = newton_addentity(thing, .05, NEWTON_CONVEXHULL, NULL);

joint = NewtonConstraintCreateCorkscrew (nworld, vectorf(0, QUANTTOMETER*1, QUANTTOMETER*1), vectorf(1, 0, 0), nthing, NULL); //no need for an actual second body
NewtonCorkscrewSetUserCallback(joint, movement_callback);

In the user input loop in main:
Code:
sensitivity = 0.005; //this is used to scale the mouse movement to acceptable velocities.
actual_velocity = NewtonCorkscrewGetJointVeloc(joint);
target_velocity = mickey.y * sensitivity /(time_frame/16) //mickey.y is given by the engine
acceleration = (target_velocity - actual_velocity)/(time_frame/16)

In callback:
Code:
movement_callback (const NewtonJoint* joint, NewtonHingeSliderUpdateDesc* desc){
  desc[0].m_accel = acceleration; //the NewtonHingeSliderUpdateDesc struct was provided, as is, by the wrapper in 1.53
  retCode |= 1; //or with 0x01 to tell newton this axis is active. Don't know if it is still required in 2.0
}


Hope this clears things up! Anyway, the concept of using PROC_LATE does not depend on any actual implementation of user input processing or callback code: time_frame values used in main and in callbacks will be different if there is a screen update in between.

The slicing woks exactly as you re-wrote, but don't cast advance as an 'int'; it must be a 'float'. The objective is that you gain control of how many times Newton is updated and how long the slices are. The NewtonSetMinimumFrameRate function let you set the same limit; however, in my case, it turned out that the several sub-splittings automatically made by the newton engine would not add up to the passed update time, and so I created my own slicing.