Download

Collision Edges: Can they be used for parkour gameplay?

Hello, Unreal Community.

I’m planning a system for detecting the edges of a mesh’s collision, but I’m not too sure of how feasible my planned system actually is. I’m new to Unreal’s C++, so I’m hoping to poke the brain of anyone with more know-how and is willing to give advice. I’m also new to the Unreal forums, so I hope that this is the right place to ask these questions. :slight_smile:

My goal is to make an automated parkour system where the character will perform different kinds of jumps or climbs based on what kind of ledge is in front of them, similar to how the Assassin’s Creed series plays. To me, it seems like the easiest and most accurate way of getting the needed environment info is to use the collision edges of meshes.

AllCollisionEdges.png
All collision edges of a mesh

I want to get the edges and determine which ones are bordering a mesh triangle that is walkable, and one that is unwalkable. This should give me results for valid ledges that the character can either jump up to or hang from (this isn’t true for all cases, but let’s start with this). If there’s any type of object that contains info for edges such as vertex positions or rotation, then I think I can get a result like shown below.

GrabbableCollisionEdges.png
Edges that I want to use

So my questions are:

  1. Is there an object that contains information of a mesh’s edges or wireframe, such as position and rotation?
  2. Can this data be accessed from a static mesh or BSP? If so, how?
  3. This one might be a huge stretch - if these objects exist, can they be traced against somehow by using something like a SweepMultiByObjectType? I’d like to sweep for just the collision edges and not the mesh’s triangles.

Thank you so much for any help that you can give. I realize that not everything that I plan may be possible, but maybe some alternative solution can come up through discussion.

I took a look at the same concept a while back ago, good luck, keep us updated on progress!

Nav meshes need this same kind of information when generating, so I’d imagine it is stored somewhere, or could maybe be grabbed from a navmesh itself.

My thoughts exactly, couldn’t find it back then… let me know if you find that info!

Anyway what I did at the time was ‘parsing’ the edges myself, but for complex polygons they require a complex algorithm which I couldn’t come up with - maybe a hull?

Hey Horus, thanks for the kind words. I actually posted in your thread some time ago with interest in the same topic, but I’ve been sidetracked from UE4 for awhile. Now I figured that I’d try working on this again and see what could turn up. It sounds like a number of people have had interest in a ledge detection system for climbing and such, so I’m hoping some kind of answer is out there.

That’s not a bad idea. I haven’t really done anything with NavMesh’s yet, so I wonder how accurately they could help to find ledges. I’ll spend a little time seeing what they have to offer.

I might be getting ahead of myself. I haven’t yet tried to access the triangles of a mesh like in Rama’s tutorials, and that might be a good idea to figure out how to use the PhysX libraries. I think I’ll spend some time learning about using libraries and come back to this issue afterwards.

The way I did this when I was testing a few gameplays was by raytracing a few meters in front of me.
I traced 1 ray from my feet then another one from a bit higher and so on until I reached the head.
By doing this you have a pretty good idea of the geometry in front of you.

For example if all rays up to your shoulders hit you know you have a wall in front of you and then use the behavior you want to climb/jump.
Another example if all rays down to your shoulders hit you know there is a low ceiling and that you need to crouch.

Wow, that’s an inovative idea!

@yamashi
That sounds like it could work for me. I may settle on something like that if I can’t make progress with my method. Thanks for the tip!

I’m currently trying to get PhysX libraries to work for me and am already having issues with #include “PhysXIncludes.h”. I posted my problem in more detail in this thread here, but there isn’t much activity yet:

If I can figure out how to get the PhysX stuff to work for me, then I can get back on topic.

I now have a problem that’s a bit of a detour, but I’m hoping that someone can help me figure out what’s going on. I have a “pointer to incomplete class type is not allowed” error. Since UStaticMeshComponent is part of the engine, I’m not sure what kind of information is missing. Does anyone have any ideas on where to look, or what the problem might be?

c48dcb015a2e92a9bfc1c8aaf435ed745f99694b.png
The CPP

dcd330b7c84fa0bc8a77f6fb9823a079c710bcf3.png
The Header