Download

How to make a Camera follow actors in game

Hi there,

Hoping to get some advice on setting up and working with moving cameras in UE4. Its not a game or anything, just world building for making short scenes.

My world setup is basically a train track, like this:
I have a BP_Tracks that is a spline going around the level, and this is used to spawn a static mesh for the train tracks. I have another BP_Cart that is the train cart that follows along the spline when the play button is hit.

Basically, I want a static camera to sit inside of the train car, and film looking outwards. I added a camera to the BP_cart as child of the train cart’s static mesh.

What currently happens is I press play and the train cart takes off down the road; but the camera and view is stuck at the spawn location where’s its placed in the Editor View. It doesn’t move with the train cart as it is animated when I press play. This is obviously not what I expected to happen.

How can I fix this?

Do you have a recommend tutorial or other thread I can follow along with for a setup like this?

Thanks.

Make the camera a child of the mesh that is moving along the spline track. Make the camera “look at” the whatever it is supposed to look at.

Yes, this is what I have done originally. ‘Added a camera to the BP_cart as child of the train cart’s static mesh.’ However, when I press play the view port is stationary at the starting area. This is not what I expected.

Perhaps I am missing something simple here. Is there a different way to ‘play’ cinematics? To force the camera’s viewpoint?
Is there a tutorial on this topic somewhere I could follow?

How are you going to present the scenes? By pressing the play button aka as a game? or via sequencer and render it out?

I am currently running it as a game. Is this something that is better suited for Sequencer?

Hoping you guys can see one way I’m trying to solve this. I’m sure this is a common problem solved before.

I tried at first to set the viewport target in the level BP, but wasn’t sure how to get the level BP to ref the camera that is inside of the Cart BP. So I had a thought today, that I should instead set the view target within the the BP_Cart, and not the level BP.

Trying to add the camera to ‘new view target’ in the ‘set view target with blend’ node, I receive the error that ‘camera component object reference is not compatible actor component object reference’.

So how about I spawn a camera actor where the camera component already is in the mesh and use that to set the view target node?

Here is a screenshot for the train cart BP. In #1 you can see I’ve added ‘Camera’ as camera actor a child of the ‘CartMesh’. In the event graph for BP_Cart. I thought I would spawn the camera there and then set the view target as the camera that is spawned. This could work?

However, how do I now reference the child camera, or its position, in this node as where I want to force the view target to be.


If you are not using game mode,

  • Add a level seq, add camera and cine track to that level seq.
  • set track at value 0 for frame 0 and the value 1 for end frame.
  • Parent the camera to the track.
  • Use camera tracking on the box.
  • Set the level bp as shown above.

This will set the camera to be the same as the seq camera when you pressed play.


IF you are using game mode.......
You will need to check the following link as it is more complicated.
see "blueprint and sequencer" video around 6mins.


https://www.unrealengine.com/en-US/onlinelearning-courses/your-first-hour-in-sequencer

Hope this helps.