Swap position between my character and ennemy

Hello guys! i’m new here so hi everyonneeee, i’m looking for a way to swap position between my character and an enemy on a collision overlap. something like if a touched him with my projectile, we switch position. do you guys have an idea on how i can do this ? thank you !

@ginxq Just use GetActorLocation and SetActorLocation, no?

A bit more detail. When you fire one of these magic projectiles, it can send a message over a BP interface to the enemy. The enemy’s response to this message is swap positions with the player using the above nodes.

On the projectile blueprint, you can select the collision volume (sphere or box or whatever it might be) to fire an event. Once you click that, you will want to create a “cast to” node. Click and drag the exec node from the component hit node and type in “cast to (whoever it is it will hit)” and then where it says “object” on the cast to node, you have to connect that to the “other actor” node on the component hit node. Then as ClockworkOcean described, it’s a simple case of getting the location you want the actor that was hit to be at. Find the location by using the “getactorlocation” node, then it really is as simple as using the “setactorlocation” node to then set the location.

You may want to create a “custom event” by right-clicking on the player blueprint, and call it “swap places”. The reason you want to do this is so that when the changing of place happens, you can easily just “cast to” the player character, and on the “object” value of the cast to player character node (the blue bit on the left-hand side of the node) by just clicking and dragging from it and typing player. Adding a “custom event” basically just creates one of these red nodes, similar to the “component hit” one. It can also be called by typing in “swap places” after right-clicking even if it’s being called by somewhere else and not just inside the player blueprints.
Then, the “exec” (the arrow pointing to the right, on the cast to player node) you can actually refer to the “swap places” custom event. Meaning you have an easy way to get the player character to just teleport.

This may have been a long explanation but I just wanted to make sure it was thorough, hope it helps.

Thank you so much for your help guys ! i will try this out and show you the result ! thanks again !!!