Hey, I’m looking for a way to compare data(interface) of the HeldActor Variable that I have with all actors or actors that the Camera sees or any way that would do the same thing(I would like to highlight place with match). But i can’t wrap my head around it. I was also looking at Gameplay Tags and Tags but had issues there too
My goal is to have objects that player can grab and place in predetermined places. Also, I would like to “outline” those places when player look at them.
This is not straightforward.
I think you need to split the concept into two parts ( only one of which you will do )
All intractable actors are blueprints
All intractable actors are meshes
Method (1) is superior, but I’m assuming you’re working with (2)?
With (2), you’ll need different material slots on the actor. All of them have the usual material applied, but when you mouse over, the grabbable parts will change their material, to highlight.
You’ll need to do this from inside the player BP ( because the mesh is just an inert object ). And you’ll need a system for remembering what materials / slot to swap in / out for each mesh. You can tag them to show they are intractable, but you will also need to keep something like a datatable which hold the interaction info. Bit of a mess.
As you can see, (2), is now starting to look more attractive
With (2), you only need to figure out which components you will highlight, depending on where they are pointing the camera ( or mouse ). You can also keep all the highlight code in the object. In fact, make a parent intractable object, then you can just extend it when you want to make a new object. Then, I’d recommend a post process highlight method, it’s much more subtle / flexible.
The way I’m doing it right now is looking for objects with PhysicsBody value and I’m already past grabbing, holding and dropping objects(also I’ve gone through picking up actors so I cover just simple meshes and actors) but I cant get over checking if that object helds desired “trait”
But I cant get like array of these I think and do it clean, I was thinking about branching and looking for every interface separately but it will look ugly
Sorry, misjudged the level you were working on.
Everything that’s pickup-able should come from a parent class.
You can do a line trace in the player, and write the object parent class so that it highlights grabbable parts for a short while.
So when the player looks at an object, it’s sending an interface message to the object ( I see you ) telling it which component it’s tracing. And the object responds by highlighting that component.
Does it make sense?
Yeah, I’ve got no idea how to do that. At this point, I’m trying to break a wall with my head.
I’ve got Actor Object Reference which I’m trying to compare with Line Trace hit result returning a boolean condition and I can’t get around Tags or BPInterfaces to get that. In a perfect world, I think it would work in an ideal world, but I don’t see any function to get around that.
Also I don’t think that I described my goal that well…
As I grab any OBJECT I get data from that object into Actor Object Reference and I keep it, then I want to use that data to compare it with other Actors in the world(blueprints probably but if there is a way go around and do It all in character bp then its ok.) and if anything matches i would like to highlight that place(for example object would be a lightbulb and highlighted place is the socket)
This is what this node is for
If something in your level is interactive, it implements your blueprint interface.
If you really want to do it with tags, use
I recommend you create a new Collision Obj Type for your interactable assets. You could then easily do sphere/box Overlaps on said objects. The custom collision acts as a filter. Also mitigates running logic checks on actors that aren’t interactable.
- Does it have X Tag?
- Does it implement Interface?
Project Settings → Engine → Collision
When you want to directly interact ( Key Press ): Line trace to obj (visibility BLOCK), then check does implement interface.
The Interactable collision type would be used strictly for Overlap events.
Two collisions of interactable type overlap each other (begin/end) → Run overlap logic on the interactable asset.
The action of interacting (Press E to do X) would use a visibility line trace. Everything in your world that’s physical (walls, doors, interactable assets etc) should block visibility. This prevents your trace from passing through a wall/door/ceiling/floor and hitting an asset on the other side.
For overlaps it doesn’t matter in most cases if the overlapped interactable is on the other side of a wall. Typically the visual overlap effects won’t be seen. In rare cases in which this is possible you can negate it via a visibility line trace when on begin overlap is triggered.
So on begin overlap (interactable): Line trace from camera to actor location. Does implement interface[true] → continue with the effect.
Key here is you’re only firing this trace when you get a successful overlap on an interactable.
That might be the answer to my problems, i’m going to dwell on that for now and try to get some progress. See ya soon and thank you both for your time!