Hey QurbanOlum,
This is fairly easy - here are the high level steps:
- Do a Line Trace by Channel and shoot it forward up to 10 meters (use the same setup as in that thread with your forward vector).
- Then break the Hit Result and check if you hit something. If you did NOT, then teleport by using the method in that thread.
- If you hit something, grab the Hit Location and subtract it from the Actor Location. Then get the Vector Length and multiply this by 0.9.
- Then use this new Float value and multiply it by your Actor Forward Vector and grab this vector and teleport to this location.
Basically, if you hit something with the line trace, you want to get the distance between the Player and the hit location and reduce the distance by some percentage (in this case I got 90% of the distance). Then multiply this distance to your Forward Vector to get the new vector location. Use this location and teleport there.
Hope this helps!