Detecting wall corners based on player's direction of movement.

So I’m making a character in my game that hides behind corners depending on location and direction the player is facing, the problem is that I want this feature to be easily modifiable and/or modular in a sense that I can easily create and/or remove locations for this character to be. The typical location for this character would be hiding around corners where a building turns at a sharp angle (usually 90 degrees) and only appears around that corner at a random chance if the player is moving in that direction.

I have no idea where to even start for this as I can’t even begin to think of a modular way to detect nearby corners. The map I’ve been making has been through the cubemap generation tool so that I could very easily modify the map.

If anyone has ideas on where to get started, I would much rather be able to get a starting point on what nodes I could use to do such a thing so that I can learn how to do something like this in the future and learn more about the engine. Thank you.

you can use EQS for this , i havent watched the following link but it may put you in the right direction

Simple way would be use some vector math and line trace.

For eg:

  • you scan (line trace) around player (around capsule component location in character)
  • you pick closest wall to character (determine wall player is hiding behind)
  • you get normal vector to wall (may be tricky)
  • with normal vector you make it ignore Z value (make it horizontal)
  • then you scan where wall ends (that is corner), so got forward/backward along wall and find corners
  • then you know where corner is

Or search fab/marketplace i think there were some plugins to detect edges.

This is exactly what I was looking for, thank you very much. EQS appears to be VERY much so modular and I can fine tune the values to be able to get the detection working nicely!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.