Go Away Z Axis

Dylan Murayama
4 min readNov 20, 2020

--

Day 21–11/19/20

Not necessarily the most productive of days, but it was a very fun team bonding kind of day. I think I only got about several percent finished on the Cinema and Stealth course, but got plenty of practice working through challenges with my fellow teammates.

During our pm team meeting, we worked through one of the filebase challenges to change the position of the cube depending on the user input. This turned out to be a really fun group experience and it seemed like everyone really enjoyed the activity. For myself, it was definitely a nice change of pace from grinding through code alone for most of the day.

For a good portion of the day, Ryan, Mar, Aaron, and I had worked on a few other challenges. Most of them we were able to knock out pretty quickly but the final one we attempted, the rotating cannon, really had us digging in our arsenal of tools to complete the challenge.

On the cinematography course, I ran into one blocker which ended up being extremely frustrating and at the same time incredibly ridiculous. I had altered my guard script numerous times trying to figure out why my guard would not switch its current target to the next point. I had thought that it was meeting my distance trigger until I finally debugged it and saw that the guard was never actually coming within 1.0f of my waypoint. Completely baffled at why this was, I then realized that I must have accidentally propper my waypoint in the air by a couple of points, thus leaving my guard about 2.0f away from the waypoint. Literally hours of recoding and digging through could have been saved had I debugged the problem earlier. I guess it is a good reminder to sometimes take that extra step to check everything.

It’s always an extremely satisfying feeling when you attempt a challenge and when watching the review you come up with very similar strategies to solve the problem. I surprised myself on the guard movement script as I almost matched the review script, which is also a reason why I was so confused as to why it wasn’t running properly. My guard movement script looks much different now than it had at the start of the day. I was actually really happy with my initial movement script as I figured out a way to cycle through the path, but after some conceptualizing, I realized that it would not necessarily be the most efficient way of scripting the enemy in a game that would require many more guards. My initial script required that each waypoint be manually set in the inspector. This worked perfectly for what I needed, but definitely not a practical way of doing things. This lead me to incorporate a bool feature to cycle through the list of waypoints.

Basically, if the object came within 1.0f of the waypoint and my count hit max, I would set a bool letting my script know that we need to count down. The same thing was done when count hit 0, I would set the bool to false and then begin counting back up.

Left is my original script, the right is the more refined version

The reason why this is a much better version of the original script is because now, I would just need to set the points for the guards and they will go through each script one by one on their own. So I could have 50 waypoints and they will now be able to cycle through all of them. My original method wasn’t far off, but if I wanted to script the path of all 50 waypoints I would have to go in the inspector and set all 50 going up and all 50 going down.

Also my script now is identical to Jon’s because of the problem I stated earlier. I thought something was wrong with my script so I mimicked his script to find out I was encountering the same problem still.

God damn z axis…

--

--

No responses yet