Line tracing for jump collision

first you implement the interface on the blueprint that is sending the data. Whatever functions you put in there will just show up when you right click on the event graph

then, on the receiving blueprint, you implement the interface just like on the sending blueprint, then you implement the event and set up whatever you want to do with the function when it gets called

oh i missed this.

the problem is that you need to “Cast To BP Enemy” after the line trace and before the branch.

But you shouldn’t cast on Event Tick, it would be really inefficient.

Okay I did as you suggested but the problem is that I don’t know what the “Cast To BP_Enemy” node is supposed to be hooked to.

If I get rid of the Event Tick node then the compile error disappears but the jumping on the enemy script still doesn’t work.

Connect the cast node to “Out Hit Hit Actor” from your screenshot above.

It’s trying to figure out what kind of actor you hit. It only knows that you hit and actor, but not what kind. So the cast node tells it that the actor is a BP Enemy

I think I might have at long last fixed the problem of taking damage from the enemy when jumping on them.

As suggested, I replaced the line trace with a box trace and after experimenting with changing the values within the box trace’s Half Size, I haven’t had any incidents since with the player taking damage when aren’t supposed to.

Thanks for all the help!

Okay, I finally got the line trace working but there’s a couple of issues that need to addressed.

Firstly, my player character is still taking damage from the enemy if the player doesn’t land dead center on the enemy’s head. The issue seems to be that the line trace is too narrow, which is probably why [ViceVersa][1] below advised using a box trace instead of a line trace. I tried swapping one for the other and while it does seem to help a little, I still feel that its not wide enough to keep the player from taking damage when they shouldn’t be.

Secondly, I’m having an issue where if the player runs into the enemy, the player character will then be bounced upwards which shouldn’t be happening. The source of the problem appears to be the enemy’s jump collision events being triggered by the trace coming into contact with the enemy, which should only be happening if the player’s Z-axis comes into contact with the enemy. However, the trace appears to be triggering regardless of which direction the player comes into contact with the enemy.

Player jump collision blueprint:

Enemy collision blueprint: