Help with adding SpringArm and Camera with blueprint

I am desperately trying to make my game as modular and upgradeable as possible

That means, that while it works to put a camera on a springarm in my pawn blueprint, this isn’t good because

a) I’d have to do this in every pawn blueprint
b) what if I decide I want my springarm length bigger? I’d have to change every one
c) or change a setting on the camera. I’d have to change every one

I thought I had initially found a solution, because I made a parent pawn blueprint for all my pawns and on THIS blueprint I put the SpringArm and Camera and this worked initially, because when I changed a setting it would work for any pawn.

The problem was that as soon as I started to move my pawn, the camera didn’t move with it. Because the camera is attached to the root of the blueprint, and not the static mesh that is being moved by the physics thrusters (how I am doing it in this case). (I don’t understand how to get ALL components of a blueprint to stick together.)

And because I made the camera on the parent, I can’t move it to be attached to the static mesh, which would replicate how it works if I just make the camera in the pawn blueprint.

So I came up with possible solutions:

a) instead of putting the SpringArm+Camera in the parent pawn blueprint, I add it in the constructor blueprint. I had a lot of trouble doing this and couldn’t in the end even get it to work, let alone working well.
the way I would like it to work is: create Springarm, attach to static mesh (which I supply to the function), then create Camera and attach to SpringArm. I don’t seem to be able to find an attach function that lets me use those things, only Actors or ActorComponents, and no casts/conversions are offered. Plus I don’t know how to adjust the length of the SpringArm in the blueprint AT ALL

b) have it so my pawn stays attached to itself the entire time. In the parent-pawn I have a capsule as the root, and static mesh of my child-pawn blueprint attaches to it. If I turn hidden-in-game off on the capsule I see it just sits there, even when the thrusters boost my static mesh around. IF I could get that to attach itself to the capsule then this whole thing would work

c) a completely different solution to the camera. perhaps a camera actor or camera blueprint that constantly references and follows the current pawn around at the distances I set for it. I don’t “get” camera actors nor understand if they are appropriate for this and have no idea how I would spawn one of these camera blueprints.

I appreciate any advice
Thanks

I have just experimented with a dummy static mesh as the root in my parent-pawn but this isn’t working either. Perhaps if I could use sockets?

I think you should be able to make the spring arm a child of the mesh rather than the root.

I certainly can do that in a regular blueprint but i put the camera/springarm on the parent blueprint (for future flexibility) but because I did that in the child blueprint I can move it off the root and onto the new mesh. if I could it would solve all my problems. which is why I wondered about creating or spawning a camera system at run time and attaching THAT to the mesh

Try with a blueprint based on playercameramanager, this one got a function updatecamera (or similar, not in front of my ue4 right now).
you can then set the new blueprint for each playercontroller with the playercameramanager property in the defaults.

see also https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Camera/index.html

Cheers,

In this case it seems that having the spring arm attached to root is only making things harder, not simpler for you. While I understand that you want to do it for the sake of flexibility, understand that components are not very flexible in Blueprint. In this case you’re better off building it with the core functionality you need now in mind rather than make things harder to program in your core functionality for the sake of secondary stuff you don’t even know you need yet.

Hmm perhaps a good point. I think what I do need to do regardless is work out how to have the camera not attached to my main pawn anyway because I now think that’s a bad habit. I still don’t “get” the camera hierarchy though. Need to spawn a camera actor/blueprint and have it follow my pawn. That would be ideal, I just don’t know how/what to do it yet.

Did you even consider looking at the PlayerCameraManager class?

With this one, you code or blueprint your camera once, and assign it to the controllers that need them. The camera logic is then seperated from the actual controllers/pawns, and you can do in there whatever you want, i.e. just set a location and rotation to the camera. You CAN use the playerlocation there, but actually you can do what you want.

I sure did, the problem is getting my head around how to use it. It’s not clear to me how to “use” the playercontroller to control the camera at all.

But yes I think this is how I am going to solve the problem when I work out how