Green points (main) are allowed to move only vertically in local space of the tank, so that they can follow wheels. There are multiple forces that effect them:
- gravity, that pulls point down
- elastic force, that keeps track from stretching too far
- suspension force which is transferred through road-wheels
Yellow points (middle) are effected by the same force when they are not in contact with obstacle. During contact with obstacles these point can move not only vertically but horizontally. This is schematics of how contact with obstacle is detected:
First raytrace between main and fixed point, detects an obstacle.
Second raytrace just few centimeters forward from where first collision was detected, gives us point where middle point should be moved:
this is how it looks like in the engine, without smooth tangents on the spline:
Unfortunately, while this approach with using “middle” points was an optimization, it has some issue which I can’t solve right now. Mainly there are situations where tracks start to jitter as middle point keeps jumping between free and collision states. Today I’ve tried replacing middle points with a several regular main points and results where better than I’ve expected. Work continues, there are still couple of things I have to try here and there before deciding on final approach.