Game Development Reference
In-Depth Information
clamping.
newVelocity.y = downwardVelocity;
agent:SetVelocity(newVelocity);
end
end
As we're clamping all of the horizontal speed of the agent in order to accurately calculate
the agent's maximum speed, this has another significant trade-off. Any outside forces that
affect the agent—for example, physics objects pushing the agent will have no effect on
the actual velocity if the agent is already at their maximum speed.