Menu

steerForWander question

Dany
2010-03-29
2013-04-30
  • Dany

    Dany - 2010-03-29

    Hi, the method "steerForWander " can accept a type Vec3 instead of a float? How could I do?

    Vec3 combine = ………. ;
    Vec3 new = steerForWander (combine) ??????????????

     
  • Craig Reynolds

    Craig Reynolds - 2010-04-02

    The argument to steerForWander is "dt" which is to say the time-step duration, and corresponds to the elapsedTime argument passed to the "update" method of your agent.  Basically it controls the speed at which the wander changes direction, and allows it to be consistent in simulations with variable frame rates.

    If you want to combine wandering with another behavior:

      Vec3 pursue = steerForPursuit (quarry, 2.0);
      Vec3 wander = steerForWander (elapsedTime);

    you can just add them together:

      Vec3 steering = pursue + wander;

    or take a weighted combination:

      Vec3 steering = interpolate (0.1, pursue, wander);

    or you can switch between behaviors:

      Vec3 steering = quarryIsNearby ? pursue : wander;

    Best,
    Craig

     

Log in to post a comment.

MongoDB Logo MongoDB