Need help with 2D teleport issue

When the player overlaps the box and teleports, if something is above the player they get stuck in the wall essentially and can’t move or do anything. What would be a good way of fixing this?

One way would be to use a line trace (raycast).

If you have line of sight to the teleportation location you can do a line trace to see where the nearest non-intersecting location could be and then use that location as the destination.

If you don’t have a line of sight, you can try a line trace or a shape trace from the teleport location outward to see if what’s the nearest non-intersecting point.

What would be a way I could connect this to the set actor location? I’m new to this in general as a heads up if this seems easy to answer, I don’t want it to be frustrating.

A line trace usually needs a starting location, an end point and some filter specifiers. You can debug the trace by changing the Draw Debug Type.

Assuming you have line of sight, start the trace from your current actor location and either obtain a vector pointing to the place you want to go (direction * some distance you want to try traveling + start), or obtain the final guessed (the location you want to TP to).

The line trace will give you a Hit structure which you can break to get the hit location, that location + some padding should be a safe teleport location.

So I would like to have the player teleport rather than from line of sight, but how would I make the line trace begin from the end of the new location rather than the start of the new location?