Parkour Trace Help

I’m trying to make a parkour system that picks specific animations based on the height and width of an interactable object, any help on how to calculate the height and width of an object and then perform events based on the output would be much appreciated.
Alternatively if anyone knows of another way to achieve to create a solid parkour system I am always eager to learn more about Unreal!

Hi!

The most dynamic way to accomplish a parkour system like that is with a series of collision checks.

While the character is not actively in a parkour move you’ll want to be running the collision checks but you probably want to turn them off while you’re in the middle of a park our move - depending on how dynic you need the system to be.

Let’s us a simple vault as an example. Let’s say that if there is an obstruction around 3-4 feet tall and <2 feet thick, you want to do a simple thief vault.

So we’ll need to find a point on top of the obstruction for the characters hand to be placed. We need to know at what location should the character start the thief vault animation. And what point the character wants to end up at on the other side of the obstruction.

First, we need to find a suitable obstruction. So for starters, let’s just do a line trace out from the character in the direction they are moving. The trace origin should probably be higher than the characters step up height. But low enough to find obstructions that we want to thief vault over. You could do it on tick, but if you can get away with tracing less often, that’ll save you some perf. The stretch goal would be to do it with async traces in c++ to really run efficiently. But don’t worry about that until you have it working and see if it’s slow. Also, you probably want to do this tracing with a small sphere - with a radius maybe 3/4 that of the characters capsule. But by all means, play around with the tuning.

Once you find an obstruction, you need to know how tall it is. If you are tracing pretty close in front of the character, we can probably get away with just tracing down towards the potential top of the obstruction and not worry about how high up the floor under the obstruction is. There’s many different ways you could go about finding the top of the obstruction. If you can start the trace from some place you know doesn’t already have a wall, that’s a good start. For example, you could trace a sphere, maybe about the width of the characters capsule or even a little less, out from the character head, forward into space, until you are above where your first obstruction trace found a hit. Except you want to trace further then that - maybe 3-4 feet further. If the obstruction is short enough, you want to know if you’re gonna have head space to move over the obstruction and stand on the other side. Then if it’s unobstructed, you’re still in business so run another sphere sweep down from the end point of your recent sweep, down to a point maybe a couple feet lower than the character current feet position. You want to find the ground height on the other side to make sure it’s good for a thief vault. If the ground is a suitable height, move on to the next trace. Now we’ll actually find the top of the obstruction. Remember the trace that went over top of the obstruction from the characters head? Find the mid point of that trace segment and trace down from there with another sphere until you find the top of the obstruction. If you find it and its a good height, save off the impact point of that sphere trace - you can use this point to put the characters hand there when vaulting. Also, the original obstruction trace can be used to find where the vault anim should start.

You can use the trace we did downwards on the other side of the obstruction to tell where the player should vault to. Then, when the player reaches the start point (probably within a tolerance), you can do the actual vault movement and anim. During the actual vault, I recommend turning off the traces and either shrinking or disabling the characters capsule collision temporarily so it doesn’t cause issues in case it bumps against things while youre vaulting. You probably want to put the character into custom movement mode during the vault as well so you maintain complete movement control.

There’s a ton of different ways you could do the traces, each with their own strengths and drawbacks. Make sure to play around with it and do lots of debug drawing so you can see what’s happening.

Another entirely different way to do a parkour system is with some kind of markup. But that’s a lot more level design heavy and less dynamic.

1 Like

Thank you this is extremely helpful! I’m still a newbie to traces, but this will be great help while trying to figure it out. I appreciate you taking the time to write that and including insight on potential issues I could run into, that will save me a lot of time!

You don’t happen to offer any sort of tutoring for unreal do you? I’ve been learning it in my spare time for the past year, but I am passionate about turning it into a career and would love to learn from someone so well versed in the software. Feel free to DM me or respond here if you are interested!

1 Like