Day 13 Beam me up Scotty!

Mark Bohuslav
3 min readDec 9, 2020

--

Very very productive day today. I rolled through a lot of Phase 2 implementations. 24 points completed out of a required 20 points for Phase 2. Technically done. However I will be going for all 28 points as no game would be complete without a BOSS battle and smart enemies that try to avoid player shots. In addition I will also add another secondary weapon to my player since I did the heat seeking missiles in Phase 1.

To start the day I added the PICK UP COLLECT functionality for the player. Now, whenever the player presses C, the Power Up collectibles will quickly move towards the player if they are in range. To give this feature some extra punch and make it even more fun to use I added a Tractor beam sound effect and did a very mild camera shake while the C key is pressed down and the Power Ups move towards the player. This feature is so gratifying to use with the sound and visual vibration. Check it out in the video below along with some of the other features that were implemented:

To complete the PowerUp Collect I used Vector3.movetowards. I also programmed the Shielded variants of the Enemy to charge towards the player and follow him when they get within a certain range using Vector3.movetowards as well.

After lunch then it was all about learning ray tracing. I read Dan’s medium article again, read some articles online and setup a test object and played around before trying to implement it in my more complicated coding environment. Dan’s advice on debugging each line really is very important. One thing I learned is that when implementing code you find from the internet into your program you will probably break things even if you think you know what you are doing. There are so many variables involved and each program is so unique, we can’t think of everything that could go wrong or needs to be changed. Learning to debug coupled with play testing will really take you far and save you time as you get better.

Using Ray Tracing, now my enemies will shoot at powerups when they are in their frontal field of view. Additionally one of the enemy variants will now shoot at the player when the player is behind them. I won’t go deep into ray tracing since I just scratched the surface of its potential but I do want to share one challenge I had that drove me nuts at the beginning. When I first started experimenting with Ray tracing I couldn’t figure out how to stop the ray trace from detecting the Origin collider instead of my intended target. I know there is probably coding to get around this problem like have the ray start with an offset and while researching this I found out about a feature that can be changed in the Project settings called “Queries start in Colliders” that fixes this issue. I don’t know why I would want my ray tracing to work inside my own collider, especially for this current project so I simply Deactivated it and now the Ray tracing works flawlessly. See below image :

Overall a very good day with lots of new concepts learned. As mentioned earlier, tomorrow I will be programming Enemies to avoid shots and get the Boss in the game and implementing another player weapon. Afterwards, I will do some more visual and audio improvements and then its post processing followed by code clean-up!

Mahalo!

--

--