Move camera on button click

Hey, everyone. Wanted to ask for help on what to do next. Here’s what I want to achieve:

I have 3 buttons and that each button once pressed should move on a specific position but instead of going to the next position, it would animate to the next position.

I added a Camera Rig Rail and attached a Camera Actor. I added a camera rig rail because I think it would be easy since I would only change the “Current Position on Rail” value via Blueprint Scripting.
It kinda works when I press the “Left button” because it would go to the position. What I am unsure on what to do next is how I am supposed to proceed to the next position.

Here’s what my Blueprint looks like:

Any help is greatly appreciated. Thank you!

Magic thing you should try first: camera arm component and turn on camera lag.

Now solution to your problem:

  • create 3 or more scene components inside player pawn bluepriints (same as camera is)
  • set up your components where you want those camera spots, together with rotation and location.
  • when you press one of buttons, enable camera lag (one that you use for transition), set camera position to one of those scene components, and let camera arm handle rest.
  • after camera is moved, turn camera arm lag back to some sane levels.

Thank you for your reply! I am fairly new to Visual Scripting and with that I would like to ask some questions.

  1. For the creating a scene component inside player pawn, is it supposed to be like this?
    scenecomponents
  2. When you mean set up my components, does this mean that I should move the 3 scene components on to where I would want my camera to be?
  3. For the camera arm component, are your referring to the Spring Arm where I need to attach a camera like this?
    springarm

Simply overwriting camera location, does not affect camera arm, so some vector math is required to actually rotate camera arm, and change its length.

create function like this:
make sure to check PURE on the left.

Then make your keyboard actions in project properties, and create EVENTS:

Because camera arm does not interpolate its length, you need to code it:
“desired_arm_length” is variable you set in keyboard events, then you read it in event tick, and interpolate arm length to its desired value.

and in camera arm settings disable “use pawn control rotation” enable camera lag, and play with its speed valuse

PS.
If you want you can drop idea of using camera arm, and instead interpolate (just like arm length) transform of camera to move it and rotate. However you will need to add collision with walls checking it etc. So code whole camera behavior.

Oh i just read your whole post :wink:
Well maybe my arm solution has some use for you. :smiley:
You probably need to reverse or reset animation while going from higher area to lower one.

Just put it on a sequence, these guys are all making it too complicated, with a sequence you can control the rotation and every aspect of the camera, on button clicked fire sequence.

1 Like