Changes I made to my moment

I have made 2 changes to improve my moment. I don’t know if similar changes will be coming in future lectures/parts of the course.

First, I added an offset field to the AIController that allowed me to move the enemies’ detection area around a bit. I moved it slightly forward and my enemies can now see better in front of them, than behind them.

Next, I added a Waypoint component and attached it to all the waypoints. This component holds the dwell time for each waypoint and it allows me to set dwell times per waypoint. So now my enemy can spend more time at one waypoint than at another. This was a little harder to add than I thought it would be because the enemy changes his current waypoint as soon as he arrives and then looks at the next waypoint’s dwell time. After some failed attempts, I added some code to look back at the previous waypoint (which is the one we’re currently dwelling at) to see what the dwell time is.

Onwards…

Well done on both counts!

A quick optimization idea for your Waypoint dwell times… try caching the value of the current waypoint’s dwell time immediately before cycling the waypoint.

Thanks @Brian_Trotter, I will certainly do that.

Privacy & Terms