Hello everyone. I am struggling a lot with this assignment I am doing. I have been trying to do it for a few weeks and can't figure out how to make further progress on this. I need to make an arrival function for AI. I can't figure out what the equation is for distance in order to continue making this function. Here is what I have so far for it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void Steering::Arrival( sf::Vector2f position, sf::Vector2f target, float maxSpeed, float maxAcceleration, float timeToTarget, float slowRadius, float targetRadius, double distance, SteeringOutput& steering )
timeToTarget = 0.1;
steering.linear = target - position;
MathHelper::Normalize( steering.linear );
//Check if arrived at target
if (timeToTarget < targetRadius)
//Check if we are out of the slowRadius
if (timeToTarget > slowRadius)
target = maxSpeed;
It gets cut off there because I know I'm not doing something right, I just can't figure out what it is. I'm sure more information is needed to help me at all but I'm not sure what information is necessary so please just let me know what else is needed.