Function AnglePIDController.Control
How much to rotate and move in order to smoothly follow a given curve.
AnglePIDControlOutput2D Control (
refPIDMovement | settings | Various movement settings |
float | followingStrength | The integral term of the PID controller. The higher this value is, the quicker the agent will try to align with the curve. |
float | angle | The current direction of the agent, in radians. |
float | curveAngle | The angle of the curve tangent at the nearest point, in radians. |
float | curveCurvature | The curvature of the curve at the nearest point. Positive values means the curve is turning to the left, negative values means the curve is turning to the right. |
float | curveDistanceSigned | The signed distance from the agent to the curve. Positive values means the agent is to the right of the curve, negative values means the agent is to the left of the curve. |
float | speed | How quickly the agent should move. In meters/second. |
float | remainingDistance | The remaining distance to where the agent should stop. In meters. |
float | minRotationSpeed | The minimum rotation speed of the agent. In radians/second. Unless the agent does not desire to rotate at all, it will rotate at least this fast. |
bool | isStationary | Should be true if the agent is currently standing still (or close to it). This allows it to rotate in place. |
float | dt | How long the current time-step is. In seconds. |
How much to rotate and move in order to smoothly follow a given curve.
If the maximum rotation speed (settings.maxRotationSpeed) would be exceeded, the agent will slow down to avoid exceeding it (up to a point).
A control value that can be used to move the agent.