Moving Along Curve
To give my leg limb end effector an appropriate target to follow during its swing phase, the target must interpolate along the plotted trajectory.Initially I approached this problem incorrectly; attempting to ‘grow’ the curve by simultaneously expanding each curve section over time, starting from the first control point.
As figure 1 shows, this places the final curve resolution point at the sum interpolation value of all sections – interpolating it along the Bezier curve.
This would allow the target position to be set equal to the final resolution point each frame.
Figure 1: Simultaneously interpolation each curve section over time |
While this did accomplish my goal of producing a target for the limb to reach toward, in practicality this prevents the curve from polling for any intersections with obstacles. The curve must be projected instantly, before movement is started so that any corrections do not distort the natural arc off the limb in swing phase.
I soon realised that one a clear path has been confirmed, the target object can be moved along the path by passing it the same control point position vectors used to form the Bézier curve.
These vectors can then be applied to the same parametric formula used to plot the Bézier curve to interpolate the object along the desired trajectory.
Figure 2: Interpolation of the target object along the plotted trajectory over time |
The addition of a speed variable value will allow me to develop proportional movement at a later stage in development.
Detecting Obstacle Intersections
Once a curve is plotted, a raycast is made between each curve resolution point to poll for intersections.If an obstacle is detected, the normal of the intersecting surface is compared against a threshold value to determine whether the surface is too steep to be traversed.
If too step, the interior curve control points will be repositioned until an unobstructed path is returned.
Figure 3: Detection of intersections, determining if surface is walkable |
When true, the target object will be interpolated along the curve.
Next Objective
With this, all the prerequisite steps have been successfully implemented to attempt creation of procedural 2D biped locomotion.My next update will be implementation of the step logic system to tie all behaviours together.