I am very new to Unreal Engine so I may have some fundamental misunderstandings about what I am doing – please feel free to correct me in any way.
My desired behavior:
Using the first person character, put the crosshair over the monitor and click. When clicked, the camera view will change to a specified Scene Capture 2D camera. I would like this behavior for arbitrary pairs of monitors and cameras.
I have imported the asset for a computer monitor to my level. It looks like this:
Originally I had a mess of code using OnClicked in the Level blueprint:
This approach had 2 problems.
- The crosshair and the mouse cursor do not necessarily line up, so the clicking did not always work properly.
- I would need to create a separate event for each computer/camera combo, I already have 17, so I can see this approach getting out of hand.
I was able to set up a line trace on my character and find it intersect with the computer:
The main problem I have is that I am unable to find a streamlined way to associate the specific computer monitor in the world with a specific camera. I also don’t really understand where to put that logic – unless I am in my level blueprint I have been unable to successfully get a reference to the specific camera like I have here:
Can anyone set me on the right track? I would really appreciate it! If it matters, I have some working knowledge of interfaces but without getting the camera reference I am struggling to figure out how to use interfaces to dispatch to a specific camera.
I also tried creating a map that associates StaticMeshActors with CameraActors but it wasn’t working – even when I had the CameraActor selected, I could not populate the Value field of the map with it. It was the correct type.
Thanks in advance!