[Moved from “Content Creation”]
Hey there,
I’m trying to set up a camera system for my 3rd person-platformer game.
The things I want to do are:
Multiple cameras which can follow the players movement but each may have different view angles, fov, functions, etc.
Switch between cameras
Blend between cameras
Looking through some docs and tutorials, many of the basic set-ups point to creating a camera component as part of the PlayerController BP. But this does not seem to be a good method for setting up a system to use multiple cameras for the player controller.
Some of the things I’ve been reading and seeing around the forums/answers involve people using Camera Actors, but I’m not entirely clear about these. Are there any strategies for setting up a system such as this that people could recommend? Any insight would be helpful.
By customize I just mean custom scripts and setting their positions in relation to the Character. Overall, I’m building a CameraSystem that will allow control over some number of cameras I decide to use during gameplay which will be controlled by the player at different times.
On the PlayerController blueprint, you can attach a camera component and attach a spring arm to it.
I want my separate cameras (not camera components) to also attach to the PlayerController and follow the player which the spring arm functionality.
I had an idea from something mentioned earlier. I’m thinking about making a separate actor with camera components. Then attach this actor to the spring-arm component on the playerController blueprint. I feel like this may accomplish the idea. Thoughts?
It depends on what you’re trying to do, but as a simple solution you could add multiple camera components to the pawn and just cycle through which one is active, can’t you? By default I think the controller will use one whatever camera component is finds in the pawn, but there’s a node called ViewTarget with blend (Set View Target with Blend | Unreal Engine Documentation) that should help with switching…and you should be able to use that anywhere you can get a reference to your pawn’s controller. You might need to disable “use pawn control rotation” in the camera components though.
For more complex stuff, I think there’s actually a camera-manager class you can override and assign in the controller…that way you could share cameras between multiple kinds of pawns/controllers I suppose…but I’ve never used it.
The placed camera actor stuff you read about are cameras placed in the level, which sounds like NOT what you want (as an example, that’d be for like… fixed spectator cameras or flythroughs in a level).
That’s the solution I tried doing first actually, adding multiple camera components to the pawn. The problem I ran into was with the ViewTarget with blend. The node needs an actor reference as the “newViewTarget” which the camera components are not. I tried just deactivating/activating which camera to show and setting the “newViewTarget” to “self” of the pawn, but this causes the camera to switch too quickly and not blend (to my surprise!) Here’s what that looks like with my current set up:
hmm… there’s also the setactive function, which is part of camera components…however that might not give you a soft blend. Maybe that can be combined with the viewtargetwithblend magically somehow though.
Ohhh, darn I never noticed that with Set View Target with Blend, I guess I was using actors when I used it. That’s annoying.
Will you be using the view from multiple cameras at the same time? If not, then there’s really no need to have multiple cameras. You could have one camera on a spring arm and manipulate the arm length, arm angle, camera FOV, etc through blueprints.
sorry about the delayed response. I won’t be using multiple cameras at the same time but I would like to have certain one’s present in the scene, and choose between them based upon what the player is currently doing. For that, I’ll be using multiple cameras instead of just one that I manipulate.
I think you want to create system like was done for original “Alone in the dark”.
Separate player character from camera. Your pawn will be camera, player character should be keyboard driven bot.
You need also some “helper actors”. I would create:
camera that can snap to mount points.
mount points that tell camera which one is active
camera volumes, that activate/deactivate mount points
Camera volume should have variable that holds reference to mount point. On construction (or begin play) mount point checks in which camera volume it is and sets reference there.
When player enters camera volume, it gets that reference and tells mount point that “you are active now mr mount point”.
Then mount point finds camera (which is player pawn, so easy to find), and tells it (camera) to snap to new point.
One warning however. Thing that i found out after i made this post.
Character pawn needs to be possesed to be able to move and rotate. It can move with input axis just fine, but refuses to rotate if its not possesed. And you cannot posses it because that would snap camera to character. This also may be something i messed up in settings of character blueprint myself.
I solved this by creating “KeyboardAI controller”. I send over (by interface call) keyboard and mouse input to this AI. Then it moves and rotates character.
For movement luckily add input works, and for rotating i use focal point. Simple move AI does not work because it needs to be done per tick, and ai move refuses to update that fast.
Maybe writing own camera manager is better option, now when there is some documentation about it. But even then most of my ideas would work for camera manager.
Just stepping in, a custom PlayerCameraManager is the easiest way to go in my opinion, since you can calculate the camera location and rotation based on, well, anything, all the time, and its the closest thing to the UE3-Cameras (if you worked with that in the past).
If there’s any need of help regarding using and coding a custom PlayerCameraManager, just ask, i will try to help; i should actually know it since my FinalCamera marketplace asset is based on the PlayerCameraManager (ok, sorry for the not-so-subtle advertising ).