creating a line trace to prevent my character from clipping through walls when leaning

I need help creating a line trace to prevent my character from clipping through walls when leaning left and right. Or any other way besides Line Trace. This my is current leaning blueprint Leaning posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Hey @Ccookie! Welcome to the forums!

This is totally doable, and a line trace would be the cheapest and most effective way.

For the vector start, use your “Get Actor Location”.

You can use “Get Player Right Vector” and multiply that by the distance you want to check for the end point of the line trace. Then add that to your “Get Actor Location” before plugging it in to get your source within the world.

Then you can simply use the boolean output to see if there was a hit, and if so, prevent the character from leaning!

Hope that helps you get moving!

1 Like

Hey @Ccookie! Did you get it figured out? Let us know!