I have a bicycle with suspension and need to find the contact point of the wheel on the "road". If the front fork was pointing straight down, it would be as easy as doing a raycast down the fork, with the raycast's length limited to the shock travel length + wheel radius. If there is a hit point, the wheel's position is the hit point - wheel radius up the fork from the hit point.
With the fork angled this same approach leads to a part of the wheel being under the detected surface. Then the wheel is moved up by the wheel radius along the fork direction. The green line is the ray cast.
Keep in mind that I do not know if the raycast will return anything nor that the normal of the detected surface will be in a set orientation. The blue circle shows where the wheel should be in this case.
The only way I can think to solve this is to do the following. Move down the fork to the maximum extension. Then create multiple points in a circle, a wheel radius away. If I then raycast from the top of shock to each one of these points. The shortest one should be the real contact point. The amount of raycasts will affect the accuracy.
It just feels like there should be a better way to do this.
In summary, I need to find a point that is a radius away from a surface. But this point is constrained to move along an axis (the fork direction).