For a while now, I’ve been working on a setup for taking out enemies by jumping on them a la Super Mario and I’ve managed to get it mostly working through use of BoxTraceByChannel, except for one glaring issue.
That one issue being that when the player & enemy collide with one another from the side, the jump collision I set up is initiated, causing the player to bounces upwards upon contact and killing the enemy in the process. This shouldn’t be happening, as the jump collision is intended to only initiate when the bottom of the player character comes into contact with the enemy & not from the side.
Is apparent that the source of this problem is the Box Trace, as the trace doesn’t seem to be limited to a downward trajectory, rather the trace will always trigger upon contact regardless of which direction the enemy collided with the player character.
So what I want to do is limit the direction of the box trace to a downward trajectory, so that the jump collision will only occur when the player comes into contact with the enemy from above and not from the side. Elsewhere I got the suggestion of using a line trace in addition to the box trace to limit the box trace’s direction. The problem is that I have limited experience in general with using trace nodes so I have no idea on how to make this work. Can anyone with a better understanding Unreal Engine 4’s inner workings help me out here?
Player Jump Collision blueprint:
Enemy Jump Collision blueprint:
Blueprint for bouncing the player upon landing on a enemy: