Camera fixed to pawn that moves on spline?

Hello,

I’m pretty new to UE4, and am having a bit of a problem. What I have is a vehicle interior that is a pawn blueprint that moves along a spline automatically. I figured out the blueprint for that, but now I want to get a camera to attach to it. I know how to create the camera, and reference it in the level blueprint so that when I hit play it looks through that camera. But how do I attach it to the pawn of the vehicle interior so that it moves with it?? Currently it stays stationary and the vehicle interior just moves on without the camera. In the end all I need is for the camera to stay fixed in the driver seat so you can look around inside while it moves.

Thanks for the help in advance! I have no coding experience, just trying to finish this project with blueprints alone.

This is the blueprint for the pawn of the interior that moves along the spline.

Level blueprint referencing camera.

I know this might be a bit simplistic, but… instead of a separate camera actor… how about just using a camera Component as part your vehicle interior Actor instead?

If this solution doesn’t suit your needs, post here and I’ll try to help out… I’ve spent a lot of time futzing with cameras

Thanks for the reply!

I can try that, do I need to connect it to any specific nodes? Or just add it into the actor as if it’s a static mesh?

welcome! yes, just add it as a child component to your interior Pawn actor BP… you can even add a spring arm, which will give you some nice smooth position and rotation lag (looks really nice)

When I add it into the actor, it just stays stationary still, it doesn’t go with the vehicle. Maybe it is and it’s just not using that camera when I hit play?

I think you are right, remember to set your vehicle interior pawn actor (with the child camera component) as the new View Target… not the camera actor in your level :slight_smile:

That’s how I set it up and it’s still not working :frowning:

Do you think I need to do anything within the pawn to connect it other than just creating the camera within it? Does it maybe require additional blueprint nodes?

I feel like I’m super close and it’s going to be something small haha

when I hit play, it puts me somewhat to the correct position, except it’s lower to the ground, and the interior just zooms off without it. This sure is a head scratcher.

a couple of questions… is the vehicle interior a Player Pawn?

One thing, I’d move the Set View Target with Blend from Begin Play in the level BP… move it to Begin Play in the vehicle interior BP… use “self” (get reference to self) in the New View Target node

So the geo of the interior is all compiled into an actor blueprint. Then to get it to move along the spline, I made a pawn blueprint that has the spline setup that references the actor for the interior. Was that a bad move?

should I have just put all the geo under a sceneComponent in the same BP?

honestly, I’m not sure I can picture the hierarchy… maybe it’s not quite ideal, but it seems to work for you (apart from the camera)… should be fine for prototyping anyway…

so the camera component is now part of the interior actor BP? and the Begin Play in your interior actor BP is calling Set View Target with Blend on itself (thereby indirectly calling the camera)?

by the way… in case you haven’t seen it already… here’s a quick reference to how Set View Target with Blend works… it is a bit confusing initially… HTF do I? Change Cameras in Unreal Engine 4 Blueprints - YouTube

When I connect the Begin Play to the Set View Target with Blend, it says “self” in that small box. Does that mean it’s just referencing the BP?

And that’s in the interior BP

exactly right… but for some reason, this might not work quite right… draw a wire out from Set View Target and type in “Get reference to self”… this will give you a little blue oval with “self” written on it…

don’t worry about this, it’s the only flaw in BP that I’ve found… some peculiarity of Set View Target with Blend… normally self in that small box is absolutely sufficient, but… just in this case… use “Get reference to self”

THAT DID IT!!!

You are seriously the best. And I think I have a slightly better understanding of this now. Thank you so much for your continued assistance.

Thank you thank you thank you.

excellent! happy to be of help… have a great day :slight_smile:

by the way, the Set View Target with Blend is the only time I’ve ever needed to use that little blue “get reference to self” … unreal’s blueprints is usually very reliable, this is the only real issue I’ve ever had with it in normal service

yeah that was a bit of a pain, especially being so new to all of this. I also had forgotten to put the “Get Player Controller” back onto the Target of the Set View Target with Blend in the interior BP. I got an error, and once I plugged that back in it worked.

so relieved.

yes… Set View Target with Blend is an unusual node :slight_smile:

just a wild thought, but you might experiment with adding a Spring Arm Component between your root component and camera component… enabling speed and rotation lag (play with the settings) looks lovely