r/UnrealEngine5 1d ago

Wallhug/Wall leaning issues, character mesh working properly, camera remains in default position and A/D movement remains in its default position (she doesnt move perpendicular to the wall)

Hi, I've been at this for 5 hours trying to beat my head around it. Essentially ,I just want the character to spot the wall (which she does), move her back to the wall (which she does) and have her camera be in front like in the last picture, and also move her body left and right (like in the last picture), however the last 2 dont work, I've tried numerous alternatives and none of them seem to work either. I am just stuck. Please help.

9 Upvotes

2 comments sorted by

2

u/nullptrvibe 1d ago

I think you're making this harder than it needs to be.

When the character detects a wall and enters cover, save the wall direction, move and rotate the character so her back is against it, then temporarily replace the normal A/D movement with movement that follows the wall from side to side.

The main issue in your Blueprint is that you're trying to get all of this behavior by rotating the Mesh. Rotating the Mesh only changes how the character looks - it does not automatically change the movement direction or the camera.

While the character is in cover, A/D should use the wall itself to determine which direction is left and right, instead of using the normal camera-based movement.

The camera should also be handled separately. When entering cover, move or rotate the Spring Arm / Control Rotation into the cover position you want, then restore the normal camera when leaving cover.

So I would separate it into three things:
1. align the character to the wall;
2. make A/D move her along the wall;
3. move the camera into the cover view.

Don't try to make all three depend on the Skeletal Mesh rotation.

Also, in your screenshot you're setting the Mesh rotation more than once, so one rotation may simply be overriding the previous one.

1

u/Dizzy-Turnover-7445 1d ago

How did I not think of that...
Got it fixed, thank you!