Blog Post: Player Shooting & Enemy Death


2/23/2024

Author: Johncarlos Lillo

Problem - 

  • Raycast Calculations Wrong
  • Zombie AI Not able to die.

Part 1: The Problem - 

In this weeks sprint, I encountered a problem correctly outputting a Raycast from the Player Camera. The Point of this Raycast was to simulate a "Bullet" from our gun, and when it makes contact with an Enemy, it should apply damage to said enemy and kill it once its health reaches zero. At first, the gun was giving us trouble and not shooting where the player was aiming, and even at times shooting backwards. Afterwards, I also ran into the issue of not being able to kill the Zombie AI, even after actually hitting its Mesh and and even applying damage. This was just as big as an issue because we wanted to give the player a way to end the game and / or proceed to the next wave. These two problems effected the overall goal of this sprint, since we wanted a win / lose condition for the player.

Part 2: The Problem Solution -
After stepping away and asking for some input from my team, I was able to understand how these errors were being caused, and quickly find their solutions. First, I realized that my distance formula was wrong, and I was multiplying TWICE, instead of Multiplying and Adding to get the distance of the Raycast to its Destination. After changing this, the Raycast was working perfectly and no longer was no longer shooting in random directions at times. Afterwards, I still had the issue of the ZombieAI not dying. At first, I saw that I actually did not apply any damage to the bullet in the first place, so the Zombie was not taking damage. Afterwards, I realized I was calling the wrong Take Damage method. I was using the Take Damage method that was created in our Health Component. I instead tried calling the TakeDamage method provided with the Unreal Engine, this fixed the overall issue and the Zombie Enemy was now able to die and be deleted on death. Overall, I believe that the mistakes that I made this week were silly mistakes, and could have easily been avoided. My teammates were able to provide another set of eyes to help the debugging proccess, and we were all able to make the player finally shoot the enemy and kill it, allowing for the win condition to be implemented into the game.

Get Deadlands Duel: Time Rift Rumble

Download NowName your own price

Comments

Log in with itch.io to leave a comment.

The guns feel amazing after this overhaul it will be even better.

Problems = Solutions