Week 8: Bee & Flower

Concept:

For this week’s assignment, I decided to have a bee as my vehicle and a flower as the target. The concepts used are wander, arrival and staying within canvas boundaries. I also adjusted the bee’s behavior based on how it really behaves and added a bit of jitter to its movement by randomizing the wander angle.

Sketch:

Code Snippet:

// Determine behavior based on distance to target
 let d = dist(vehicle.pos.x, vehicle.pos.y, target.x, target.y);
 let steering;
 if (d < 150) {
   // If Bee is close to flower, "arrive" behavior with edge avoidance
   steering = vehicle.arrive(target);
 } else {
   // If Bee is far from the flower, "wander" behavior with edge avoidance
   steering = vehicle.wander();
 }

In this code snippet, I made sure that the bee goes on wandering around until it reaches a specific distance from the flower, then it arrives to the center of the flower.

Future Improvements: 

I would add more bees and flowers and make the bees randomly arrive on any flower.

Leave a Reply

Your email address will not be published. Required fields are marked *