How do I add the "E" prompt to a movable object after I aim my crosshair in it?

Well, yes I can. However you have to figure out how to do it yourself.

Approach 1 (Easy shortcut way) : You can have on overlap→show interaction prompt on other interactables. At that moment you can add player a tag, something like “IsAlreadyInteracting” so you can prevent other interactions close(false) at that moment. Both have their own ui so it is not mixed.

Approach 2 (Proper Way) :

Have 2 actor components. BlueprintClass - >Actor Component

InteractionComponent : Holds data for the interaction like name, status etc.

InteractionScannerComponent : Scans every actor in a radius that has InteractionComponent. With the rules you define on it, it picks the most relevant one and displays to you.

Interaction UI : Simply can be always ready but invisible in HUD. When InteractionScannerComponent founds and validates an interaction, it can tell UI or UI can simply listen if there is a validation event in scanner. I prefer to spawn multiple.

The Rules: You can write some functions in blueprint in the scanner component. Like

  • CanInteract→Checks some variables (a bool maybe) or tags if interaction enabled.
  • IsInViewCone→ Checks if current interaction cone angle matches player look angle. Can be narrow or big
  • More rules you can write if you need or prefer like.

If you do this way you system would be more extendable and proper. You can build more on it in time.

On your current system simply you can scan actors that implements **InteractionComponent. If(True)**→Access Variable (PromptName : Door, PromptAction: Open, PrompStatus: Locked ) . Simply going with this architecture would unlock you to do many things without another interactions system required. You can even define things like Interaction distance to it like 10m and add a rule function for it. If distance less than 10m, it is false. When you press E it tells interactions component to fire event and you can do whatever it needs to do (physics pick, open door)

These are just mindset to put you in the correct direction to achieve whatever you need. You current InteractionScannerComponent is basically your camera, if you would need proximity, relevancy based interaction simply you need to change it to a scanner (collision) + Trace.

ezgif-46142765e32d06

something like this, basically mix of multiple rules distance, viewcone, key, status

1 Like