I am currently working on a game with exploration elements.
The core-game and functions are built in Blueprint, once that has been achieved I am bringing in a programmer to polish the game functions and mechanics.
Currently I am having an issue with splitting the character and the camera in Blueprint. I have looked through many tutorials however I’ve been unable to find a solution.
My goal:
To have a camera fixed to 1 point in the level, controlled with the mouse.
Separately have a character you control with keyboard controls.
Where I am stuck:
I have managed to set up a player controllable camera, fixed to one point and can orbit around a fixed point (however I am unable to zoom in/out, which is also wanted)
I have managed to set up a key controlled player character (Basically third person setup)
But I have been unable to combine the two, so when I hit the play-button I can move the camera separately of the character. Now it is only one or the other.
I have tried making an illustration/example:
So a player is exploring a mountain, so the player can explore the level with the camera separately from the character. Whilst the character has other mechanics and requirements within the lever.
Make 2 pawns: one with just camera, one with character. You posses Camera pawn, process all input in player controller and send it to character.
When you want to switch camera just change camera pawn transform. And make camera in camera pawn rotate to look at rotation, to see character.
Easiest way to setup multiple cameras, is to make some “dummy” blueprint that has arrow or some mesh marking location.
Place those dummy marker meshes in places where you want camera, “get all actors of class” for those markers.
Then apply same transform to camera as selected marker bp from array.
You could always make camera inside character and update its position in event tick, but this produces some snapping now and then.
Currently I have a Camera Pawn and a MyCharacter Pawn. I could still only control the character, unless I went into World Settings and made a Gamemode Override to control the CameraPawn. So now I can control the camera pawn, but not the character. I tried getting the Pawn Reference from the character into the CameraPawn blueprint, but I have no idea where to attach it.
So I’m still stuck only being able to control one of them, and not both at the same time. I’m still not clear how to manage to control both of them, on player start.
Hello,
If you create a reference of your CameraPawn (Create variable and select your pawn as variable type) in your CharacterPawn and set it on event begin play with your camera in level. You Use custom event to fire your camera actions and call them from your reference in your character. It would be ok. (With CharacterPawn set in gamemode)
I know this thread is pretty old but i found another solution that doesn’t involve using 2 actors. If you use the construction script in the actor blueprint you can right click and search for “detach from parent” and just connect that to the construction script box and set the target to be the camera. However you will probably have to change the default camera position, after detaching from the parent it spawns at 0,0,0 so make sure to set and new world location so your camera doesn’t spawn in the floor or completely away from your map. Goodluck
Would this work if I wanted to camera to be in the style of a custom 3rd person camera? I am trying to feed my pitch and yaw floats in for the mouse input but can’t seem to get a response.
You don’t need a camera in a pawn. You can put a camera in the player controller. That camera can conceivably be moved to wherever you want.
That being said, a second pawn for the camera will also work fine, and if you already built that, there’s no reason to switch.
How can you do what? Add a camera to the player controller?
Open up the blueprint editor for your player controller subclass. Add a camera component, perhaps with a spring arm. In begin play, set this camera as the active camera. When you receive input that should move the camera, move the Player Controller actor. When you receive input that should move the player pawn, tell the player pawn to move.