NewtonUserJointAddLinearRow is used for to drive relative distance, speed and acceleration between a point on each body to zero. To understand this, read the following with reference to the image further down.
- You decide upon two points, fixed on each body respectively. It is the relative quantites between these two points that will be driven to zero.
- Each time the constraint is calculated, you pass the global position of these two points as pivot0 and pivot1.
- Also, you provide a dir vector which defines the direction in which the quantities are reduced to zero. Therefore you drive to zero one axis at a time.
To understand what Newton does imagine the following:
- Draw vectors through both points in the same direction as the dir vector
- Through each pivot point draw a line perpendicular to the dir vectors, that meets the the other body's dir vector
- The distance between these two lines is what Newton drives to 0
- An equivalent process is also done for velocity and acceleration
By continuously driving the variables to zero the joint effectively maintains rigidity along the dir vector. The examples in the next few sections should hopefully give you a better understanding of how this works in practice.