PDA

View Full Version : Vaulting & Ground Sliding Movement



LucasWalter
02-22-2012, 12:30 AM
Hello everyone!

In my game I am trying to create a vaulting/ledge grabbing system similar to in the Call of duty series, and a ground sliding capability similar to sliding in the game brink.

Lets start out with the ledge grabbing/vaulting functionality. I have read theagents tutorial covering this subject, but I believe I am look for something different, which wouldn't require me to place every single actor in the editor that I want to be able to vault over. My idea is to just have and exec function that will determine if the pawn is next to the obstacle, then play an animation, and finally push the pawn up and fowards towards the wall/ledge/barrier.

There are a few questions I have regarding how to do this.

First of all, I only want this to be able to be done on obstacles up to a certain point, to do this would I have to place every actor in the editor or is there another way to accomplish this? If so, what is the first step towards doing that?

Next, How could I distinguish between the two obstacles heights and which animations to play, etc. For example how would the player know the difference between pulling itself over a high ledge or vaulting over a pile of rubble?

Lastly, What do I need to do to get the player to actually get 'pushed up' and over the ledge?



Now for the sliding:

I really do not have much of a clue where to even begin on something like sliding, but I think I would need to do something along the lines of determining if the player is sprinting or not, then lower the players eyeheight(First person, not true first person camera), and finally change how the player can use the weapons(Make less accurate)

I am really just wanting to find a good starting point on this functionality and I would take it from there.


Thank you

.Wrath
02-22-2012, 04:51 PM
First of all, I only want this to be able to be done on obstacles up to a certain point, to do this would I have to place every actor in the editor or is there another way to accomplish this? If so, what is the first step towards doing that?

Next, How could I distinguish between the two obstacles heights and which animations to play, etc. For example how would the player know the difference between pulling itself over a high ledge or vaulting over a pile of rubble?

No. You do not need to place hundreds of actors in your level simply to make sure that you can vault them.
There are tons of threads on vaulting...Usually using traces to detect the information needed.
Here's a crash course of a simple method that could handle this:

First we throw Trace1 at knee height to see if there's anything blocking us.
http://desmond.imageshack.us/Himg696/scaled.php?server=696&filename=trace1e.jpg&res=medium

If we don't hit anything, then we Trace (2a) down to see if anything's underneath it.
http://desmond.imageshack.us/Himg838/scaled.php?server=838&filename=trace1b.jpg&res=medium
If we hit something, we know it can be vaulted, b/c its height is so low.

If we do hit something with Trace1 then we start recursing traces (2b) vertically to find the top of the object.
http://desmond.imageshack.us/Himg196/scaled.php?server=196&filename=trace1a.jpg&res=medium

The next time we miss one of these horizontal (2b) traces, we'll know we're above the object, and can start tracing down (3b) to find the height, and the edgeLoc if we want it.
http://img846.imageshack.us/img846/4775/trace2a.jpg
So, the next time you miss a (3b) trace (or it hits something that isn't the thing you're trying to vault), you'll know you're past the front edge and can use the last hitlocation from the previous trace as your best edge location.
you can judge whether or not the pawn vaults by the magnitude of the height difference between your best edge Loc and your Pawn.Location or simply:

VSize(BestEdgeLoc.Z - PawnLocation.Z)


Lastly, What do I need to do to get the player to actually get 'pushed up' and over the ledge?

either through manipulation of the pawns velocity or otherwise scripting the movement.


Now for the sliding:

I really do not have much of a clue where to even begin on something like sliding, but I think I would need to do something along the lines of determining if the player is sprinting or not, then lower the players eyeheight(First person, not true first person camera), and finally change how the player can use the weapons(Make less accurate)

I am really just wanting to find a good starting point on this functionality and I would take it from there.

Can't help you there, as the approach would be a matter of preference.
But you already seem to have a starting point that could be achieved rather simply.

Good Luck.

P.S. you may want to search for threads containing the word "Parkour" as most of the time they're trying to achieve a similar result.

LucasWalter
03-10-2012, 01:41 PM
Thank you for your response as it was very helpful, but I am still having trouble figuring out how to apply this to what I am using. Right now I am just using an arms mesh for my first person game and I do not have a full mesh to put sockets on at the knees and eyes to accomplish this.

What would be the best way to do this in my situation, I am assuming that the it is basically the same concept but I am not sure how to determine where the knees are etc...

.Wrath
04-08-2012, 06:46 AM
Sorry for not replying sooner.
When you throw traces you always define your start and end vectors first.
To start a trace at the pawn's knees you could do something like:



var vector Rot, TraceStart, TraceDest, HitLoc, OutHitNorm;
var actor HitActor;
var tracehitinfo outhitinfo;

Rot = vector(Pawn.Rotation);
TraceStart = Pawn.Location + (rot * 8.f);
TraceDest = TraceStart + (rot * 64.f);

HitActor = Trace(HitLoc, OutHitNorm, TraceDest, TraceStart, TRUE, , OutHitInfo, TRACEFLAG_Bullet);


to adjust it up and down you simply use float operators to adjust the Z component.

i.e.


//move it up 10 uu's
TraceStart.Z += 10
//move it down 10 uu's
TraceStart.Z -= 10

blaklion
07-12-2013, 04:06 PM
How would you do this on collision components or landscapes? Say there was a mountain with a ledge but u made this mountain through the landscape tools, can it work?

Acecutter69
07-12-2013, 09:10 PM
wouldn't it be more efficient 2 only use 2 traces instead? trace from the knees and if you get a hit, add about 4 units along the trace direction and something like 70 units up and trace downward to find the height? its sorta what i did here


http://www.youtube.com/watch?v=7F2kj08_vq8

I also evaluate if the normal is close to opposite of the pawns rotation to avoid vaulting in diagonal angles.

blaklion
07-12-2013, 10:51 PM
But does it work on edges in landscapes or collisioncomponents? Simpler does a landscape have a collision component. Cuz basically say there is a wall and you trace the edge but there is also a bar above it, it will seem glitchy. Also if you use splines or volumes its tedious to go all around the map and search. So you see does the trace detect collision components?

Acecutter69
07-12-2013, 11:04 PM
traces hit anything that has blockzero extend to true i believe, and yes i do believe terrain has collision or else you would fall though the map.

Acecutter69
07-12-2013, 11:06 PM
btw all the buildings in that demo are done with bsp's