Function PIDMovement.Accelerate

Accelerate (float speed, float timeToReachMaxSpeed, float dt)

Accelerates as quickly as possible.

Public
float Accelerate (

float

speed

The current speed of the agent.

float

timeToReachMaxSpeed

The time it takes for the agent to reach the maximum speed, starting from a standstill.

float

dt

The time to accelerate for. Can be negative to decelerate instead.

)

Accelerates as quickly as possible.

This follows the same curve as the Speed function, as a function of the remaining distance.

Return

The speed the agent should have after accelerating for dt seconds. Assuming dt is small.