Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development How to Make a Video Game Score, Enemies, and Game State Create Enemy Navigation and AI

Gerrit Verhaar
Gerrit Verhaar
17,742 Points

my bird doesn't stop walking (it stops at the position of the frog, but doesn't stop its walking animation.) RESOLVED

Stopping Distance is 5, Auto Braking is True. When the bird hits the frog the frog is gone, but the bird doesn't stop to its stop animation. When I change Stopping Distance to 7 it stops, but the frog stays alive.

Any idea what I might have overlooked?

Hi Gerrit,

Please verify the "Bird" game object's "Nav Mesh Agent" component settings are:Radius=1;Height=4;Base Offset=0. For example, increasing the Radius value would result in the Bird walking past the frog after the collision was detected. If the Radius is less then 1, a stop distance of 7 would stop the Bird short of colliding with the frog.

  • HTH

2 Answers

Gerrit Verhaar
Gerrit Verhaar
17,742 Points

found a way to solve this:

in PlayerHealth.cs / OnTriggerEnter I first destroyed the player when the bird hit me ( Destroy (gameObject) ). I changed that now to: gameObject.SetActive(false);

Now the bird stops after eating the frog.

Wow.. good work! Yeah, if you don't flip the active flag, the bird will keep "hunting". You know, I always learn more from the mistakes I make...

Gerrit Verhaar
Gerrit Verhaar
17,742 Points

Thx John, for the reply. radius=1, height=4, base offset=0, stopping distance=5, auto braking=true

but with these settings the bird stays in the walking animation after it has eaten the frog (it does stay at the same place, but doesn't fall back to the stop animation)

any other suggestion?