Download

Attaching a camera and a spring arm to an actor

So I’ve got an actor, and I want to attach a camera to it via spring arm, and then make that the primary camera for the level. There are two ways to do this that I’m aware of, which are both causing issues for me.

  1. Click on the actor in the world outliner, add a spring arm component, then add a camera, and make the camera a child of the spring arm. This is fine, however, when I try to use this camera in the “Set View Target with Blend” blueprint function, I get “Camera component reference is not compatible with Actor reference”. This seems to be because the function wants a “Camera Actor”, instead of just a “Camera”.
  2. Create a camera actor inside the scene (just by adding a “Camera” in the class search box, under place mode). I can use this in the “Set View Target with Blend” function, but can’t figure out a way to attach that to the other actor, since I can’t seem to make that a child of the spring arm.

What’s the best way to make this work?

Hi and welcome to the forums!

Have you tried creating a blueprint using the actor and setting up the camera components there?

What do you mean by ‘setting up the camera components’? I can bring the cameraActor reference into that blueprint and use it properly, but then the camera isn’t attached to the spring arm at all. I can create the camera in the blueprint, but then when I try and use that camera with “Set View Target with Blend”, I get “Camera component reference is not compatible with Actor reference”.

In the blueprint viewport add a spring arm component to your scene root then add a camera component as a child of the spring arm component. The camera should then appear under Variables > Components for you to drag in and use.

It does, but using that camera variable with “Set View Target with Blend”, I get “Camera component reference is not compatible with Actor reference”.

Can you provide a screen shot of your ‘Set View Target with Blend’ inputs or the blueprint?

Sure thing.
0758431f83fbe0710a4725919745e11f466f27dd.png
It might not be clear in that screenshot, but the input for “Target” comes from “Get Player Controller”, which ended up being covered by that tooltip.

Try setting new view target to self. It should use the actors camera component automatically (not 100% as I’m not able to try this atm).

That doesn’t have any effect, unfortunately :frowning:

Hey, that worked! Thanks a bunch Naveed.

Hi,
Sorry for digging this out but I have the exact same problem but i can’t use this workaround (using self) as I have multiples cameras…

How can i do that ?

I’ve got the same problem, it doesn’t appear like Set View Target with Blend works anymore with camera components, only root camera actors.

@MagicNono @mflux
You may have to rely on a PlayerCameraManager class and build all your camera-related blueprints in there. Spawn the PlayerCameraManager from the player controller.