You can get the Event Hit
node, then get a Get Actor Location
node, plug the Other
pin of the Event Hit node into the Target
pin of the Get Actor Location node, after that, get the player character’s location by using the Get Actor Location node again but this time don’t plug anything into the Target pin (assuming this code is gonna be in the character blueprint) and plug it’s Return Value
pin into the A pin of a subtraction (-) node (the A pin would be the upper one) and once that’s done, plug the Return Value pin of the other Get Actor Location node that we use to detect the hit object’s location into the B pin of the same subtraction node (the B pin would be the lower one), then finally, plug in the result of the subtraction into a Normalize
node, get a Launch Character
node, and plug the final result into the Launch Velocity
pin of the Launch Character node. If you don’t want the player character to be pushed up or down, you can split the final result by right clicking on the output pin of the Normalize node and selecting the Split Struct Pin
option on the menu that pops up. Also do the same for the Launch Velocity node, and only connect their x & y axis together. (This is not the same with overriding) Also you can multiply the result of the Normalize node to adjust the launch velocity to your liking
The approach I explained above would also work, but I noticed some issues while testing it myself and don’t think that it would be the best method if your objective is not just pushing the player character away from a moving object but rather moving the player with it. So I did a little research and found this post:
Hope this helps!