Need help on interacting with multiple instances of a BP

So I’m creating a first person puzzle prototype. Players would interact with things by just walking up to them and pressing “E”.

So I have an actor blueprint (object A) that does various stuff. I want to be able to rotate object A clockwise and counterclockwise with two buttons that are on object A, which my players can interact with. I am also going to be placing object A around in my level alot.

I currently using an interface blueprint to try to interact with other objects. I have a linetrace come out from the player and whatever actor/object it hits, it tries to call an interface event from it. Now I know that my line trace hits the buttons on object A and it returns object A, not the buttons.

I’m not quite sure how to go from here because I’m still a noobie to blueprints. How should I go about this? Even if I do get the button references, I’m not quite sure how to do it. I figure that the 2 buttons would probably have to be a different blueprint but how would that work if I have to rotate multiple instances of object A?

Interact in my first person character BP: https://i.imgur.com/q7Y18Nm.png

Trace script: https://i.imgur.com/CvO1r4R.png

when I interact with it via linetrace,
it obviously returns object A, NOT the
cubes/buttons.

Line trace returns a generic object reference; cast it to A, get your cubes buttons reference from there. It would look like this:


Admittedly, I do not fully understand how the interaction is going to work so it’s kind of difficult to advise precisely. There are many methods. It all depends on what you’re planning to do and how modular an interaction system like that is going to be.

Do consider providing extra detail in case you need a more specific advice.

Hey! - you fell into the same trap as me!

I was separating everything into different BPs until I discovered you can line trace to components.

Just tag the components with ‘clickable’ and then during the line trace you can look for that tag…
:slight_smile:

I figure that the 2 buttons would
probably have to be a different
blueprint but how would that work if I
have to rotate multiple instances of
object A?

So hold on, you want to use buttons on any object instance to rotate all instances, is that correct? Like in a puzzle game of sorts? And then any B object’s button affects all B objects?

I understand now. Is there a reason why you want the buttons to be static meshes (you mentioned having them returned by a trace)? And how would the player interact with them? With keyboard? In the video you linked they’re just button prompts. Maybe you just want widgets instead?

In which case, I’d just create a widget in the player / player controller blueprint. And have the player controller rotate the currently selected object. If it’s a simple rotation, you don’t even need an interface for it.

Sorry! I added more details to my post now.

So Object A has 2 buttons on it. Each one that rotates it in a different direction. Lets say that theres 2 Object As; Object A1 and Object A2. If I hit a button on object A1, it would only rotate object A1. Same could be said for Object A2.

Kind of like this. Resident Evil 5 (Ch 4-2 Sun Beam Puzzle and The Origins Pt. 2/2) - YouTube
I want to do something like this where the character is rotating the mirrors. Just in first person and without locking onto the mirrors. I want to rotate the mirrors with 2 buttons on the back left and right of the mirrors.

There were no reason for the buttons to be static meshes. The player would interact with them with a keyboard, preferably using the E key. Currently when the player hits the E key, it sends out the linetrace and interface blueprint. I haven’t really thought about the UI aspect of it yet.

Just to keep things simple, the UI does not need to do anything, it’s just a prompt. And there’s no need for every object to implement their own controls. The object can implement their own methods, sure. But the controls should be in one place.

Here’s a quick and dirty 5 min implementation:

This needs more work, obviously but that’s the gist, right?

Image from Gyazo

Gotta scoot before I get lynched for that button solution, it’s pretty unconventional.

That looks awesome! Let me try to give more details I guess.

This is my object A. The two highlighted white cubes are the buttons that I want to be used to rotate the whole object. The idea is that the player walks up to this object and interacts with one of the white cubes to rotate ALL of it by 45 degrees. I just don’t quite know how to interact with the white cubes.

I guess to specify how would I detect the specific component(one of the white cubes) with a linetrace and then depending on the component, rotate either clockwise or counter clockwise?

So why don’t you configure the trace to return the cubes, not the object:

  • give each cube 2 tags Left or Right and InteractiveButton
  • get Hit Component from the hit struct instead of Hit Actor
  • and rotate during tick as previously demonstrated

This way you can use E key to rotate either way, depending on which button the player is looking at.