I am just looking into some ai behaviours and am struggling to get my head around this at the moment. Want to get this simple Seek behaviour to work but can only find a code sample in c++. Anyone able to change it into Java so i can understand it better?
Vector2D SteeringBehaviors::Seek(Vector2D TargetPos)
Vector2D DesiredVelocity = Vec2DNormalize(TargetPos m_pVehicle->Pos())
return (DesiredVelocity m_pVehicle->Velocity());
First the desired velocity is calculated. This is the velocity the agent would need to reach the target position in an ideal world. It represents the vector from the agent to the target, scaled to be the length of the maximum possible speed of the agent.
The steering force returned by this method is the force required, which when added to the agent's current velocity vector gives the desired velocity. To achieve this you simply subtract the agent's current velocity from the desired velocity. See Figure 3.2.
Thanks in advance if anyone can help! Or better yet, if anyone knows any Java Artificial intelligence sites that would be so helpful