Change View on clicked object
Hi Guys, we want to make a main-menu without the classic button style. Instead we want to use the environment as our menu. Much like Driver, for example we want to exit the game when clicking on the door. ClickedOn as a event which should start the action. We placed leaderboards on one wall of our map, in front of them we placed a camera. This camera should be activated when clicking the leaderboard. Does somebody know how we can do that? Even with a normal click on a menu-button, the camera is not changing to another camera. I used the following answer for that: https://answers.unrealengine.com/questions/298895/how-to-change-cameras-by-umg-button.html Thank you guys.
asked Jan 27 '16 at 03:14 PM in Blueprint Scripting
The way camera system works in UE4 is that PlayerController, which has CameraManager has set so called view target. That view target is a actor that should be viewed and camera manager ask that actor on every frame how it like to be viewed (it directly ask about camera position) by calling CalcCamera function, which by default picks first found active camera component inside it self and sends back it's world position as a camera position:
You can change that behavior by overriding that function in C++, but sadly you can't do that in blueprints. So in blueprints you need to utilize fact that it uses first found camera component, so use camera component in actor and it will be used when actor becomes view target, if you have multiple camera components activate and deactivate them to switch between them. UE4 got simple CameraActor just with camera component alredy made, so you don't need to create empty actor with camera just to have independent camera.
To set view target you use this node (you seen it in that other question you linked):
It has bland function so if you set camera right you don't need to use any matinee to animate it
You also need to keep in mind that by default PlayerController when it possesses new pawn (which also include on start of the game) it will automatically set it's view target to possessed pawn, you can disable that by setting boolean in PlayerController "Auto Manage Active Camera Target" (you can set that in defaults, should be in "Player Controller" category)
answered Jan 27 '16 at 04:53 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here