I´m making a interaction system, so when you look at the scene component “Intractable” I need it to send a event to the character etc. Basically my goal is:
When you look at a door knob, a npc, or anything intractable it popups a text saying the name of the interaction. And when you press space it interacts, very easy to do in all other engines, but I can´t understand how to do it in UE4. Thanks in advance
You will need to do a line trace with a blueprint interface. I would setup a distance limit so it does not pick things up too far away.
I use this when coming up to shops, so when the player is close enough and taps the screen, it finds which BP I have tapped on and runs scripting within that blueprint. i.e. opens a widget.
You could run this off event tick, so where ever the player is looking, it could check example 500 ahead and when hits a intractable , a widget opens and you can run interaction of that.
Thank you, I’m an experienced programmer so I know all about interfaces, I just don’t know how to put like a collision box on a scene component. I’ve worked with other engines and it has worked there very easily
A line trace is an option… you could also add a collision component and use ‘hit’ or ‘overlap’ to generate the event. I think I’ve seen youtube tutorials on this topic implementing interfaces too
Thank you, I know how to do collision and line traces and interfaces and all of that, my question is still how to add a collision sphere to a SCENE COMPONENT, that is very important. Would a line trace work for SCENE COMPONENTS ? It´s important that my system is dynamic, not a brute force solution
Okay, in unity and Arma this was very easy. I just made a added a trigger box to it and have it a script. I don’t want to hand code each . Maybe I could have the scene component attach a collide on start. Thanks
@MomoLegitMan… as far as I know scene component and a collision component are simply different things.
As you know, you can have a collision component and scene component in the same location on your actor. But… as far as I know a scene component in itself will neither collide with other objects nor block a trace (though I haven’t tested it… and your proposition worth testing though).