Posted March 18, 2023 by mditcharo
AUTHOR: MYLES DITCHARO
ISSUE: Our boss had an issue where when using his chop attack in phase one, he would sometimes send a hitbox off the stage depending on where the player would stand. This was to be expected because the 3D calculation to get the chop location was really simple. All it was doing originally was applying an offset to wherever the players current position is. This lead to a sort of choppy unnatural feel.
SOLUTION: To fix this issue, I had to figure out a way to add randomness to the chopping while keeping it within the stage boundaries. To achieve this, before each chop, I get the player position. With the current position, I use that as a center point for getting a random point within a bounding box with set extents. This on its own gives a more random feel; however, it still doesn't solve the attacking out of bounds issue. To remedy this, I take the new random position and clamp it between a min and max that I get through an actor placed into the level to determine where we want the attacks to land. After this math, I have the start of the effect I want to achieve. With some more changes to the randomness, this attack should start to feel more challenging and intuitive for the player