Robot Simulation

I'm trying to use Unity Steer for an MSC project:

My project consists of a flat arena, with cylindrical obstacles, and an AI controlled "Robot".

The player will be able to move on this arena as first person controller, upon mouse click or a key press, an object "food" will be instantiated in front of the player.

The Robot should be idle until a "player proximity" event is triggered, upon which it will wander, avoiding obstacles.

If an instantiated object "food" is present on the scene, the robot will move to target on it, while still avoiding obstacles. The food will disappear after a number of seconds, re-triggering wander. If no more "food" is spawned within a time limit, the robot will tether to base and go idle again. The classic cat and food scenario.

I have the individual behaviors working, with move to point, and wander radar behaviors. I need to merge the two of them, possibly with some form of state machine or behavior tree triggering either of them according to the state of the scene, as I have animation for wheels turning, turning, eat, and waggle tail to be triggered as well depending on state.

I noticed that placing both scripts on the robot component makes the obstacle avoidance brake, even if one of the two scripts is inactive.

I assume I need to write my own behavior and vehicle script, that merges the Arrive and Wander, implementing radar as well, finding this rather difficult.

my question is:

1)What is the best approach to switch between two behaviors/vehicles, do I need to write a new behavior that merges wander and arrive?

2)How do I make the robot look for an object at run-time, currently target is set on awake.

sorry for two questions in one, feel free to edit :)

it sounds like you'll be better served by building your own custom vehicle. Since steering is very much dependent on the game, UnitySteer was meant as a collection of steering functions, not ready-to-wear behaviors, and the others are there mostly as examples. What you want is something that alternates between MovesToPoint and Wander, always using obstacle avoidance. Look at the "Avoid Obstacles" scene for a wandering kitty that, as advertised, avoids obstacles while remaining tethered to a point in the scene.

As you mention, a state machine is an option for how to blend the behaviors, or you could also look at AngryAnt's Behave for a likely cleaner solution. I believe his example is precisely a kitten looking for food (and napping).

There are several approaches to look for an object at run-time, but it would depend greatly on how you want your robot to act. Some options:

  1. The simple case would be a random walk, where the actor simply moves from one place to the next;
  2. Have it remember the directions in which it has searched recently and give them less of a priority;
  3. Remember in which areas it found food before, and prioritize those;
  4. Remember where it has seen the player, and search in those areas, as the player is the one instantiating the food;
  5. A combination of the above.

Each approach will alter the way your robot behaves, so it depends on the effect you wish to achieve.