Hello everyone,
I’ve come to a point where controlling my main I would like to approach an object or actor in a certain radius and a material icon would be displayed above their head and rotate to my character so its always facing my view. When I leave the distance the icon is not visible anymore. I am using “E” as the input so I created a Material in Photoshop that I would like to show. I want to implement seeing this as I approach an NPC or Secondary character and they do an animation(ThumbsUp). How do I go about this? Is their a tutorial out there that helps with all this?
I created an Interact Interface and I’m not sure how to get the floating material if its a widget or something else.
Thanks for any help hopefully this was easy to understand what I’m trying to achieve here
There are many ways this could be approached, but you’ll want to identify the actor as interactive in some way. You can make them a specific class, like an ‘Interactible’ class for example. You can put a sphere overlap collider on your player character and when it overlaps, cast the object to ‘Interactible’ and if it’s successful, have the Interactible object add to itself a billboard image component. You could do it with a widget component as well, but you can achieve it in a more simple manner.
Just don’t put the collider on the interactive object because it’s better to have one object checking for overlaps that dozens or hundreds.
I got the icon perfect by using a widget on my second character, it’s displayed where I want it, the radius for visibility works and it follows my mains camera. So that’s Great.
Now I’m trying on my mains input interaction key (E) in radius of my secondary character for the second character to play an animation. but nothing happens no print string displayed. It seems the interface is not messaging between the 2 actors. I am trying to get the print string to work before I try getting the animation.
Here are some images. Hopefully I’m not to far off. Thank you for the reply
SecondaryBP
Interface
MainBP
Rather than using an interface, I’d recommend just checking overlap on the player character and try to cast the other actor to your SecondaryBP. If Successful, call a method on your SecondaryBP that prints a string or whatever else you need.
So I did kind of what you mentioned and it works this way by the pics uploaded. But I feel this is very impacting and interface could be more beneficial, what’s your opinion? I just can’t seem to get the message of the event Interact Interface from 2nd character to get to my main character to work.
What happens with this setup is when controlling my main in overlap of 2nd character I press “E” the 2nd character faces my Main no movement while animations is going on then continues back to AI controller to do whatever the BT does. It works thank you for your advice. I really appreciate it.
I’m still just wondering about interface stuff since my Interact Input will also be used to open doors, pickup objects, start climbing. Interactions of all sorts.
Pics-
MainBp1
MainBp2
2ndCharEvent1
2ndCharEvent2
2ndCharEvent3
You’re on the right track, but the way that is currently implemented is very expensive. A Straight overlap > Cast > Call flow is faster than an interface. Let me show something like what I mean.
You have a collider on your player character (like a sphere) set to OverlapAllDynamic. Now when it overlaps another actor, OnComponentBeginOverlap will be called. You can create an event for this function in your BP by right-clicking on the sphere component and choosing “Add Event.”
Then you cast the 'Other Actor" to your SecondaryBP class. I used a StaticMeshActor in the screenshot above just to demonstrate, make sure you’re using the right cast node for your class.
Then if the cast is successful (top pin) you can call PlayAnim on that actor.
You don’t need the line trace or ‘get all actors of class’ or any of that!