12.1 GOTO
In this example we utilise the prebuilt function goToTarget()
. This function takes in an object of type VecPosition
which is a size 3 vector which stores the x,y,z coordinate positions. For this example we are going to get the agent to constantly want to move to the balls position. To do this inside selectSkill()
we return the following statement:
return goToTarget(ball); // Walk to the ball
Here we use the goToTarget()
function with an input parameter ball
. ball
is an inherited variable of type VecPosition
which represents the position of the ball. By returning goToTarget(ball)
in selectSkill()
the agent will move directly towards the ball without trying to avoid any other obstacles along the way.