Function PIDMovement.OptimizeDirection
Finds a direction to move in that is as close as possible to the desired direction while being clear of obstacles, if possible.
float2 OptimizeDirection (
float2 | start | Current position of the agent. |
float2 | end | Point the agent is moving towards. |
float | desiredRadius | The distance the agent should try to keep from obstacles. |
float | remainingDistance | Remaining distance in the path. |
float | pointiness | Essentially controls how much the agent will cut corners. A higher value will lead to a smoother path, but it will also lead to the agent not staying as far away from corners as the desired wall distance parameter would suggest. It is a unitless quantity. |
NativeArray<float2> | edges | Edges of obstacles. Each edge is represented by two points. |
CommandBuilder | draw | CommandBuilder to use for drawing debug information. |
debugFlags | Flags to control what debug information to draw. |
Finds a direction to move in that is as close as possible to the desired direction while being clear of obstacles, if possible.
This keeps the agent from moving too close to walls.