Stop camera movement in a sidescroller?

I was wondering if anyone knows how can I can stop the movement of the game camera in a sidescroller game.

There’s multiple reasons why I would like to be able stop the camera’s movement such as for fighting bosses/mini-bosses or for single-screen rooms, but right now I need it for the death animation I’ve been working for the past couple of days.

You see, the death animation I’ve made so far for my player character is similar to :

295725-rip-mario1.gif

Most of the death animation sequence is complete, however, one thing that needs to be addressed right now is that when my player character dies, the camera follows them all the way down as they plummet through the level’s geometry. Instead, I want the camera to stop moving the instant the player character’s health is reduced to 0.

I should also mention that I’m using a custom camera setup based on the one from tutorial video [[Link][2]].

Event Graph:

Construction Script:

Get New Y Value:

Get New Z Value:

Character Blueprint:

As you can see the setup for custom camera is rather elaborate and not something that I can easily decipher myself. I was hoping that someone who is more knowledgeable about kind of stuff could help me figure out how to build off setup to come up with a way of stopping the camera on command, unless there’s another way to stop the camera’s movement without fiddling with blueprint that I’m unaware off.

Thanks in advance!

Either you set your DeadZone to a very huge number when the player dies or on your EventTick create a Branch. If your player is alive (true), get your new values and set the ActorLocation, is he is not alive (death animation / false) create a DoOnce to set your ActorLocation only once, so it will stay there.

1 Like
  • switch the player cam from relative to world - way it will stay where it is and can be made relative and reset once we’re done
  • or start overriding its location every frame
  • or switch to another camera
  • or use the camera manager and simply stop updating the camera when it’s supposed to sit still

There’s probably more options.

1 Like

In case bullet points seem to dry. #1 it could look like maybe:

Image from Gyazo


But it’s probably easier (and safer) to switch to another camera. Look into the Set View Target With Blend node. Should work well and you even get automatic yet optional interpolation.

1 Like

Sorry for the extremely belated response, after months of getting shoved further and further down the priorities list I finally decided to get around to trying to fix problem.

Anyways, I decided to try L1z4rD89’s suggestion of changing the camera blueprint’s DeadZone value first since it appeared to be the simplest one to try.

change_deadzone

So I added some code to the player character’s death script to change the camera’s dead zone upon the player’s death as shown above. Unfortunately, there appears to be something wrong with my implementation as not only does the camera still work as it did before, the new code breaks the death script, resulting in the player not dying upon their health reaching zero and messing with the jump collision with enemies.

Okay, so I replaced the cast to the camera blueprint with Get Actor of Class and that did the trick!

As per L1z4rD89’s advice, I changed the ZDead Zone value to an extremely large number when the player dies and it does stop the camera’s Z-axis movement.

I’m not sure if there’s any risk to using method for the stopping the camera’s movement but it does seem to work for my purposes.

Assuming you are using a separate camera actor that means the camera is not parented to the character. You must have someway of getting that camera actor to follow along the player’s Y like a typical side scroller game. You just need to stop that exec when you need to for whatever reasons. In that logic that moves the camera actor to match the player, put a branch in there with a bool that will stop the flow when the character dies or reaches the checkpoint /flag pole etc etc.