Changing Sidescroller Camera Rotation for In Game Effect

Hello everyone.

I am working on a project that is a 3d side scroller. What I am trying to accomplish is give the player the feel that they are walking around a city block. What I want to do is create an effect that when the player presses a button, it gives them the feel that they have turned the corner and are now on another street, while still being side scroller oriented. One of the suggestions that I have been given was to make it so that the world shifts 90 degrees instead of having the character turn.

My thought process would be to shift the SpringArm of the base character 90 degrees to cause this effect, effectively making it so that the character looks like they turned the corner. Or create a cinematic effect or an animation that makes the same thing happen? Any suggestion would be greatly appreciated.

Hello Rocky,

I have the same porblem while doing the similar project .
I can turn the character without any problem but the camera just won’t move.
Have you figer out any solutions yet ?
If you do could you please share with me?

This sounded like an interesting problem, so I gave it a quick go with a blank 3D sidescroller project.
For simplicity’s sake, I just added the corner rotation with a trigger instead of a button, but it should work just the same with a n action command.

Anyway, basic setup:

Simple Actor BP with a box collision.
On Begin Overlap, call a BPI to the character to rotate the camera.
(For my quick test, I didn’t check which direction the character should turn, but you can add that logic yourself…)

On the character, I stored the World Direction vector from the movement input as a variable, because we need to rotate this vector.
Also, if starting from the 3D sidescroller template, uncheck “constrain to plane” in the character movement.

When the rotate camera event is called, just run a few nodes to rotate the vector for the movement, and play a short timeline for a smooth camera transition, like this:


https://forums.unrealengine.com/core/image/gif;base64
​
If you spend more than a few minutes on this, you may want to improve the transition (e.g. play a “walk around corner” clip, check that the character isn’t currently jumping or whatever…)

The quick and dirty test looks like this:

1 Like

Hey, I’m trying to get this working in my game. I’m not really sure what nodes I need to set, I’m a bit confused as to how to implement this. Can you post the blueprint so I can understand what nodes I need to set?

Really struggling with this (I’m sure it’s simple) and the forum post has been deleted or set to private. Does anyone know how to replicate exactly what is shown in Mickey’s screen above? I’ve tried the steps, but without the blueprint, I’m having a hard time getting anything but the camera spring arm to pivot 90 degrees. Any help is appreciated!

Unfortunately, the original screenshot is gone after last year’s forum update, and I didn’t save it or the project…

However, I had a few minutes to try to recreate the prototype, so here’s the 2022 version:

It’s still rough, but should be enough to illustrate the idea. This is still using the 3D sidescroller template, so all steps below are based on starting there.

  1. I added two variables to store axis value and movement direction - these are needed later.


    Axis value Forward tells me which way we should turn, and Movement direction is the vector along which the character moves. By default, this is -1 on the Y axis in the example project.

  2. The trigger actor is a basic BP with just a collision box and an overlap event.
    Below are the nodes on the trigger actor:

If it overlaps with the player character, the BP Interface fires on the character controller
Nothing fancy here…

  1. Back to the player controller, let’s add the movement direction update:

A) We take the movement direction vector variable and rotate it based on the axis input.
By default, moving right is +1, so we rotate the vector 90 degrees “forward”. If the character moves left, it would rotate it the other direction.
Since we set the vector, the change in movement direction is instant here, but you can improve this part with some blends or turning animations based on your preference.
B) Fire a custom event to rotate the camera (see below)
C) In this version, I kept “constrain to plane” turned on, so I’m just switching the constraint axis. In the default project, movement is along Y and the constraint axis is X. So if we see that the current axis is X, change to Y, and vice versa.
This works well for 90 degree turns and stops the character “floating” and getting misaligned during the turn, due to its velocity.
If you want to get more creative and add non-right-angle turns, or curves or whatever, you’ll have to improve this part…

  1. Camera turn is a simple lerp driven by a timeline:

“Update Camera” is the custom event that is called above.
A) Store current camera rotation
B) Calculate target rotation. 90 degrees is the default for this, and it rotates “left” or “right” depending on which way the character is moving.
C) Timeline is a simple float, 0.5 seconds long going from 0 to 1, which in turn drives the lerp between camera start rotation and the target rotation. Again, super basic and you can expand to your desires.

Too lazy to make a new video, but it functions pretty much the same as seen in my first reply.

1 Like

WOW Amazing! Sure enough, this worked perfectly! Thank you sooooo much! The only part I’m missing is that I had to disable “constrain to plane” which is causing my side scroller character to slide off of their plane when they collide with some objects. Do you know if there is a good way to disable and re-enable the constrain to plan so that it keeps it locked on both axis as it’s moving, breaking only to make the move?

Why did you have to disable “constrain to plane”?

That’s the most reliable way to stop the floating, so you should try to find out why you had to disable it.
If you started with your own logic instead of the side scroller template, maybe check if your initial constraint axis is the same as in my example above. If so, then modify (C) in the Update Direction event

I am using the 3d Sidescroller template. When the character turns the corner, the no longer move. The mesh faces correctly and the camera spring arm switches but the movement doesn’t continue unless I uncheck constrain to plane.

Yeah, that sounds exactly like it’s constrained to a plane that no longer matches the movement direction.
Compare the movement vector to your plane axis and adjust accordingly.

Note, though: if your movement vector is +/-Y, the plane to constrain to is X - don’t use the same axis/plane for both movement and constraint

Hi, great post. I just have a one question (probably very stupid one), as a 3D artist I have a little knowlege about blueprints. I managed to follow the instruction but I simply cant find a way to call Event Update Direction from step 3. I did everything else. It’s probably something super basic, because I can’t find solution on the internet. Could you help me?