I’m in the same contest. Why don’t they simply add sight cone to the engine ■■■■…
Any updates? I was thinking about procedural mesh, but it’s quite expensive though.
I’m in the same contest. Why don’t they simply add sight cone to the engine ■■■■…
Any updates? I was thinking about procedural mesh, but it’s quite expensive though.
Hi everyone. I am trying to achieve the following:
create a basic cone (really just a triangle at his feet) to represent an enemy’s line of sight
This sight cone must not go trough walls.
The first part, I’ve found several ways to accomplish. The second, I’ve no clue where to begin. Does anyone know of a good way to get this working?
Edit: There may have been some confusion in the way I phrased my question, so I’ll try to be clearer.
I already have perception set up. What I am looking to do, is to create a visual representation of the enemy’s perception so that the player can know if he/she can be seen.
This video is a good example of what I’m after:
Also (unrelated), how do I get a youTube video to just show up instead of being a link?
I suggest you do a line trace.
Not entirely sure what you mean by cone, so I’m just gonna presume you are using an actual cone(cone shaped collision or whatever) to represent sight range.
You can get overlapping actors from the cone, do a line trace, and check for blocking hit. If something’s blocking, it means whatever the object is it is behind an obstacle. If not, then it is visible.
The line trace should be performed every frame for everything that’s overlapping the cone.
If what you meant by cone is just hypothetical area that a pawn is supposed to spot an enemy within, then one should be given further information to answer to your question. IMO.
Hope it helped.
Try to add a Pawn Sensing component to your Enemy AI BP. After you did that you will be able to call an event from it named On see pawn (there’s also On Hear Pawn, but you need a Noise Emitter component on the other actors for that). This system is gonna give an easy to set up system like the one you want. You can decide how far the enemy can see and the shape of his “cone” of visibility. Last thing, it’s gonna automatically work so the enemy is not gonna see you trough walls.
What said is correct. You can use built-in PawnSensing. You don’t necessarily have to build your own sensors for AI unless there’s some special needs.
Hi there netcop207. I guess I could’ve been clearer. I already have sensing enabled. I don’t need to make the enemy see, I need their vision to be visible for the player. By cone, I literally mean drawing a cone on the floor to visually represent the enemy’s vision.
This [UE4][Free] Field Of View TestProject is pretty much what I am trying to accomplish, but it seems like the links to their project are down.
The link got all weird, sorry.
Hi there Vertigo. I am already set up in that department. I’m not looking to have the character perceive, I’m looking to make his perception visible. Like in this video. Thanks though.
you can draw debug shapes for that. Just search for functions called Draw Debug and you will have plenty of options to build the shape as you want it
Thanks vertigo, but debug shapes are not what I’m looking for. I need something a bit more complex. It needs to reshape itself to the environment at run time and I need to be able to apply materials and post processing to it.
It needs to be polished enough for the player.
I’ve actually gotten a lot closer using procedural mesh generation and the EQS system.
Hi everyone. We eventually got this working using procedural meshes and the EQS system and made a video about how it’s done. Thanks to everyone that tried to help!
Note: There were a few things in the video that weren’t quite perfect (We fumbled a node connection and forgot a to add +1 in a section) so do read the description, where we explain how to make it work perfectly. Hopefully this will help anyone who stumbles into this thread.
Visible sight cone: