Rotate Character to Face space between two walls

Hey gang, so I can’t figure out for the life of me how to word this right to find good results, so coming to the forum.

I have a basic BP set up where the player can wall through a tight space, however, I want to lock the direction/rotation of the PC when they activate the BP (that way they are not going sideways through the wall when activating the BP.

I feel like getting the forward vector is a start, but honestly, I’m stumped after that.


some pictures or diagrams would help. It seems like you are wanting the character to walk sideways like squeezing through a narrow corridor?

Correct. I edited the code into my post just now. I’ll put up an image of the BP in a moment.

image
Here’s a mock up up the placement of the BP. The Manny’s orientations are the spots the player can go into (North or South in this example.)

If you know where in the level this action is needed, the typical solution is to put an overlapping detector volume in the area with the narrow passage.
When the character starts overlapping that volume, you change the camera and animation and movement such that it behaves like you want.
Typically, you may have multiple “modes” in your system, such as climbing, swimming, crouching, … and thus this will be just another mode that your camera and animation and locomotion systems need to be aware of.

gotcha. There is a few parameters with the character class and the character movement component that you’ll be interested in.

A basic setup could be something like this: Mesh rotation can be in the animation, and then when overlapped with the trigger you can make it so that character no longer rotations with the controller rotation and also does not orient to movement using these variables:

If you don’t have a dedicated animation you can just set the characters mesh rotation manually. You could just grab the world rotation from the trigger actor and set to that. You can add an arrow component to the trigger so that it is easy to see in the viewport what the orientation of it is.

You could do some math to derive a desired vector in relation to the trigger but I dont see the point. You have to manually place it in the level.