I have problem with SceneCapture2d and get this camera view.
In level i have one scenecapture.
The image is cast on the box (blueprint actor).
I want to create an interaction now - the player walks to the box, pushes F and the player’s camera changes at this moment, now we see the picture from the camera (scenecapture), after pressing again we return to the normal view.
The problem is that I have no idea how to get a camera view in the blueprint function.
The only way I know how to use scenecapture2d so far is to create a RenderTarget texture with it, make a Material out of that, and apply the Material to a UMG widget or a static mesh.
This makes the view from the other camera appear on the surface of another object.
But it sounds like all you want to do is switch the player’s ebtire viewport over to the other camera instead of the ome their pawn was born with. You dont need a scenecapture to do that, you just need to get the playercontroller → get camera manager → change view to camera with blend
Or something like that. I dont remember the node names exactly.
I create something like a TV set. The TV continuously displays the live image when I interact with it, I want the main camera to change when interacting with the one we see on TV.
That’s what I would do, but I don’t know how to get the camera from level to my blueprint function.
To change player view to any camera view, use SetViewTargetWithBlend function. It gets camera component inside actor and uses it as new view target.
Link it as property. For example, in your “box blueprint” create editable Actor variable. Put box into level, select it, open it’s details and set camera actor as this actor property. So now you have a reference of camera actor inside box blueprint.
To better understand how to communicate blueprints in unreal, explore BlueprintCommunication map in ContentExamples project.
If your code is in the level blueprint then all you have to do is select the camera in the viewport and then right click in the level blueprint graph to create a reference to the selected actor. For other blueprints the method above should work.
That is even better than my idea!
SetViewTargetWithBlend has an input “New View Target” for the actor object that has a camera. If your actor at the level is BluePrintActor, then the pointer to it is a “Self” (Get a reference to self) in your BluePrintActor.
(Self)---->[New View Target]