The Wander Steering Behavior creates the illusion that the agent is randomly walking around the game scene.
You can set the distance offset between the agent and the Wander target using the method below:
voidsetWanderOffset(float uWanderOffset)
You can also set the wander circle radius using the method below:
voidsetWanderRadius(float uWanderRadius)
And you can also set the rate at which the agent computes a new random velocity.
voidsetWanderRate(float uWanderRate)
The snippet below shows how to compute the final velocity using the Wander Steering Behavior.
//1. Create an instance of the Wander Steering BehaviorU4DEngine::U4DWander *wanderBehavior=new U4DEngine::U4DWander();//2. Set the Wander OffsetwanderBehavior->setWanderOffset(3.0);//3. Set the Wander RadiuswanderBehavior->setWanderOffset(2.0);//4. Set the Wander RatewanderBehavior->setWanderRate(0.5);//set wandering positionU4DEngine::U4DVector3n targetPosition;//5. Compute the final Velocity using the Wander Steering Behavior. uSoldier is an instance of your game character.U4DEngine::U4DVector3n finalVelocity=wanderBehavior->getSteering(uSoldier->kineticAction, targetPosition);if(!(finalVelocity==U4DEngine::U4DVector3n(0.0,0.0,0.0))){uSoldier->applyVelocity(finalVelocity, dt);uSoldier->setViewDirection(finalVelocity);}