Hi folks!
Been playing around some with Unity lately and been using the uScript editor to sort of “ease myself in” to the visual scripting thingy…
However I tried yesterday in UE4 to create a simple camera that I want to follow the player, sort of like a thirdperson camera… I know there is an option
to create this from an existing template, but just for the sake of learning… I thought that this might be a good “experiment” to get into the UE4 Blueprint scripting…
but Im actually not sure where to start… is there any good tutorial around for this or is it that simple that some kind soul could help me here?
What I actually would like to achive is an ortographical camera thats looking and following the player from the side (like and old school 2d platform-game, such as Super Mario Bros).
If you look at the templates marked as Blueprint projects, these should actually be good reference for what you’re looking for, since they come up with basic character Blueprints that you can dissect and play with. The Swing Ninja sample game uses a camera set-up that’s fairly close to a 2D feel as well.
There are a few different ways you can set up a camera for a player. If you want to keep it simple to start, I think the easiest way is to just add a camera component to your player pawn Blueprint and position it with a relative offset and rotation you like. If you look in the Blueprint defaults panel, there’s a property labelled “Find camera component when view target”, which is enabled by default. This means that when the pawn Blueprint is possessed, the the engine will check for a camera component inside it and use that camera as your viewpoint.
The second property you need to pay attention to is in the details panel for the camera component itself, labelled “Use controller view rotation”, which you’ll want to disable if you’re creating a side-scroller. This option is more for third- and first-person games, where you want to rotate the camera using a mouse or right analogue stick on a controller. If you leave it enabled without doing anything to change the controller rotation, it’ll still override the camera’s rotation and just point it down the X axis.
Hope that helps - without knowing about those properties, figuring out cameras can get kind of tricky.
Thomas - if i can ask a slightly related but different question:
If you want to make a custom character controller or just a 3rd person controller like in the default, how easy is it to do from a blank project?
Ive tried for days now to create one by copying the same component etc but it never works out. Usually the camera in the blueprint component doesnt act as the camera when i press play in my own version. Im placed in the centre of my character.
I feel its great that unreal has these short cuts but i feel i need to know how to create my own controller to proceed.
Ive defined my axis, made a game mode BP and a character BP with components of a player controller i.e. the arrow, mesh etc.
But it just won’t work… Am i making life hard for myself or am i missing something simple…
When you made your Character BP, did you choose Character as the parent? If so, you should automatically have all the parts (movement, mesh etc). You cannot add a CharacterMovementComponent to any BP, the only way to get one is to derive from the Character class. This should still give you lots of flexibility though!