Plug-and-Play Character Interaction Component

Hey everyone!

I thought I’d share a little something I’ve put together - an ActorComponent which allows your characters to interact with each other, or with arbitrary objects in the world!
Just add it to your actor or character - it’ll have an outline when looked at and will respond to being used.

Images (and gifs!) speak more than anything, so here’s a couple:


What the blueprint side of things looks like on an interactive objects. There are events for OnStartFocus and OnEndFocus as well.
The Intent enum is there to show how objects can have multiple functionalities, based on what the character wants to do with it. It contains a number of common actions such as Light, Lockpick, Conversation, Open, etc. You can then switch on these in code to do different things on a single object. The enum itself should be set before InteractWithTarget is called.


Inside a character blueprint where it wants to interact with stuff. Yes, that is literally it.


Outlines á la Tom Looman


Interactive objects support individual outlines!

You can download the source code and the outline materials here: http://directorate.asuscomm.com/files/public/UE4/CharacterInteractionComponent.7z
The code is extensively commented, and in your blueprints you should only ever need to use the above node and events.

Using the component is fairly self-explanatory, but the gist of it is this:

Your player character will need one set to either Interacting Character or Interactive and Interacting Character. The latter allows your character to be activated by other characters in turn, should you wish to use this in a multiplayer environment. Do note that I haven’t tested multiplayer interaction, and that there may be some replication issues.

Any mode which includes Interacting will allow the character to see outlines of objects and interact with them. Your interactive objects will need a component as well, preferrably set to Interactive Object - this will allow them to have outlines and fire OnUsed events. If you’ll ever possess them for some reason, Interactive and Interacting Character may be more useful. Keep in mind that this mode keeps the tick enabled, and while it doesn’t really do anything when it’s not a pawn or isn’t possessed, it is an additional tick that’s online.

The rest of the properties are fairly self-explanatory. Explore! I’ll be here to answer any questions, if you have them ^.=.^ Pop me a PM or post where, whatever floats your boat.

A great big thanks to Tom Looman for his UE4 tutorials which set me on the path of creating this, as well as for his outline material. Materials are black magic.

Nice work mate, and thanks for sharing it with the community! :slight_smile:

Much thanks, this will be quite useful :cool:

Short little notice! I’ve updated the code to comply with 4.8 standards - it’s a minor thing, but it gets rid of some messages that were bugging me :stuck_out_tongue:

Handy! Does this recognize when you change what you are looking at? So on changing focus, do something with the old actor?

Nvm, was on break and didn’t have time to read through the whole thing. Answered my own question.

Was just about to reply x) As you saw, there’s no dedicated event for it, but it would be trivial to add if you needed it.