How to Differentiate Between Multiple BP Instances?

I’m creating a fixed camera set-up like this: A BP that has a camera component inside which gets triggered via a trigger volume on being overlap. The Trigger Volume gets manually placed inside the level (I’m storing it via eye picker inside an exposed variable).

This works well enough, I run into the left trigger volume and it sets the left camera as the active view. I run back into the right trigger volume and the right camera becomes the active view. This works no matter how many times I copy and paste the camera BP.

Now here’s my problem, I want to center the camera on the player via the press of a button, this works perfectly well as long as I’m inside the trigger volume of the first placed camera BP (the right one), however if I’m inside the second one (the left one), then the button press is still triggering only the firstly placed camera (which I’m not seeing since the second camera is now my view target).

I’m getting the camera from inside the ThirdPersonCharacter BP via CastToFixedCamera Class > Get Actor Of Class > Camera Component.

Any ideas how I can differentiate between multiple placed BPs even though they’re all the same? If I access the camera component with Get All Actors Of Class > Get, like this:

343738-キャフチャ2.png

Then I can directly influence via the integer slot which of the camera BPs is working with the button press, Integer [0] is the first copy and integer [1] is the second one. This means UE4 has an internal array of all the copies of the BPs inside the level, right?

What would be the best way to handle this situation?

Are you using the key input for testing? You could just code the BP to always point the camera at the player using ‘LookAtRotation’.

However, if you want them all to respond to keypress, you’ll need to make sure the key isn’t captured:

343745-screenshot-1.jpg

Then, you can put in the BP to only respond to the key if the player is in it:

In fact, thinking about it, the first thing is enough, because we don’t care if all the cameras rotate… :slight_smile:

Your solution totally makes sense but it didn’t work for some reason. Now the first camera works as long as I’m inside its designated trigger volume and once I’m inside the second one, none of the cameras get rotated.

I’ve posted my BP on BlueprintUE, maybe the problem lies in the way I’ve set it all up.

Also, thank you for taking time out of your day to help people on here, it’s greatly appreciated! :slight_smile:

You can drop the overlap check, and you don’t need get actors. Each volume already has a reference to it’s camera…

This is it, you don’t need any other code:

You can use this in the construction script to get the volume scale and camera position right:

343783-camerapos.gif

343786-ezgifcom-gif-maker.gif

That is working nicely, thanks again for taking your valuable time to help me, you really went above and beyond! :slight_smile:

You’re welcome :slight_smile: