Wall jumping
Wall jumping
Hi guys,
What is a good way to do a wall jump? I put some example code in the pastebin
http://inside3d.com/pastebin.php?action=show&id=146
http://inside3d.com/pastebin.php?action=show&id=145
id 145 is the original Quake jumping implementation.
What I'm trying to figure out is how can you simulate something where you can kind of kick off the wall.. so you'd jump and touch the wall brush and be able to jump back
id 146 is kind of close but it more or less sticks you to the wall.. what's a good way to jump off it and be able to scale a flat surface by jumping back and forth towards the wall??
What is a good way to do a wall jump? I put some example code in the pastebin
http://inside3d.com/pastebin.php?action=show&id=146
http://inside3d.com/pastebin.php?action=show&id=145
id 145 is the original Quake jumping implementation.
What I'm trying to figure out is how can you simulate something where you can kind of kick off the wall.. so you'd jump and touch the wall brush and be able to jump back
id 146 is kind of close but it more or less sticks you to the wall.. what's a good way to jump off it and be able to scale a flat surface by jumping back and forth towards the wall??
-
- Posts: 129
- Joined: Sun Jun 05, 2005 9:59 pm
I did this once by sending out tracelines a short distance to the left and right. If either of them hit a solid surface while the player was in the air, he was launched upwards and sideways with an accompanying jump sound. It worked pretty well, I found, and can be adapted to jump in any direction.
Looking at the code, you'd pretty much want to switch around the FL_ONGROUND and FL_JUMPRELEASED tests and put your wall-checking code between the two.
Looking at the code, you'd pretty much want to switch around the FL_ONGROUND and FL_JUMPRELEASED tests and put your wall-checking code between the two.
thanks for the tip! I'm experimenting with traceline (); and findradius ();
Quake Matt wrote:I did this once by sending out tracelines a short distance to the left and right. If either of them hit a solid surface while the player was in the air, he was launched upwards and sideways with an accompanying jump sound. It worked pretty well, I found, and can be adapted to jump in any direction.
Looking at the code, you'd pretty much want to switch around the FL_ONGROUND and FL_JUMPRELEASED tests and put your wall-checking code between the two.
for jumping off of entities, the thinking is that if a character has the strength to jump off a wall, they should be also able to vault off of a monster tooUrre wrote:findradius will not find walls of any kind, not even brush entities afaik (someone correct me if I'm wrong), so I don't see the use of that in your case.
-
- Posts: 129
- Joined: Sun Jun 05, 2005 9:59 pm
You should be able to use traceline for that too, since it can detect the hitboxes. One of the arguments it takes is findmonsters - you've just got to make sure it's set to true and you should be away.for jumping off of entities, the thinking is that if a character has the strength to jump off a wall, they should be also able to vault off of a monster too
Yeah, just do a few different tracelines in a circle around the player. Set nomonsters to false and the trace will hit monsters/players too.
Any that have trace_fraction set to 1 didn't hit anything.
This will give you a value in trace_plane_normal.
Use trace_plane_normal to set the velocity of the player to travel away from the wall. If you're brave, you can try combining the normals from the different traces so jumping in a corner of a cube will bounce you into the center of the room.
findradius is impractical to use for finding moving platforms, and too clumsy to use to find the bounding boxes of monsters. Just use traceline and it'll tell you what it hit, the angle of what it hit, and where it hit.
Any that have trace_fraction set to 1 didn't hit anything.
This will give you a value in trace_plane_normal.
Use trace_plane_normal to set the velocity of the player to travel away from the wall. If you're brave, you can try combining the normals from the different traces so jumping in a corner of a cube will bounce you into the center of the room.
findradius is impractical to use for finding moving platforms, and too clumsy to use to find the bounding boxes of monsters. Just use traceline and it'll tell you what it hit, the angle of what it hit, and where it hit.
-
- Posts: 129
- Joined: Sun Jun 05, 2005 9:59 pm
Re: Wall jumping
Here's my code i used in the past...dayfive wrote:Hi guys,
What is a good way to do a wall ...
clientq.c add above putclientinserver()
Code: Select all
void() player_touch =
{
if ((other.solid == SOLID_BSP) && (self.button2))
{
if ((time > self.timetojump)&& (time > self.timetojump2))
{
if ((!self.flags & FL_ONGROUND)) self.flags = self.flags + FL_ONGROUND;
self.velocity = v_up + (self.velocity * 2);
self.velocity = v_forward + (self.velocity * 1.05);//small push when jumping
self.velocity = v_right + (self.velocity * 1.05);//small push when jumping
self.timetojump2 = time + 0.5;
return;
}
}
}
Code: Select all
self.touch = player_touch;
Code: Select all
self.timetojump = time + (0.2); //double jump
![Smile :)](./images/smilies/icon_smile.gif)
Re: Wall jumping
how do you define timetojump and/or timetojump2 in this example ?
is it declared as a .float or a .vector somewhere ?
is it declared as a .float or a .vector somewhere ?
r00k wrote:Here's my code i used in the past...dayfive wrote:Hi guys,
What is a good way to do a wall ...
clientq.c add above putclientinserver()
in void() PutClientInServer = add somewhere in the middle..Code: Select all
void() player_touch = { if ((other.solid == SOLID_BSP) && (self.button2)) { if ((time > self.timetojump)&& (time > self.timetojump2)) { if ((!self.flags & FL_ONGROUND)) self.flags = self.flags + FL_ONGROUND; self.velocity = v_up + (self.velocity * 2); self.velocity = v_forward + (self.velocity * 1.05);//small push when jumping self.velocity = v_right + (self.velocity * 1.05);//small push when jumping self.timetojump2 = time + 0.5; return; } } }
then add to the last of ' void() PlayerJump 'Code: Select all
self.touch = player_touch;
this will allow 1 boost jump off a wallCode: Select all
self.timetojump = time + (0.2); //double jump
have fun!
so i tried the example code and i was getting more like a pogo stick type effect.
i just was experimenting with it and i came up with this which is kind of close but is lacking in a few key ways
it needs to somehow stop when the jump button is held, at present it just keeps propelling upward. if you press jump and release and press again you can kind of stairwalk which is sort of what i'm going for, but against a brush.
i just was experimenting with it and i came up with this which is kind of close but is lacking in a few key ways
Code: Select all
if ( !(self.flags & FL_ONGROUND) && (self.button2))
{
if ( (self.flags & FL_JUMPRELEASED) )
self.velocity_z = self.velocity_z - 12.5;
self.velocity_z = self.velocity_z + 25;
self.flags = self.flags + FL_ONGROUND;
self.button2 = 0;
}
.float timetojump;
.float timetojump2;
If i just hold +jump it doesnt keep jumping....
the time delay on the second limits the space between initial jump off ground to contact with wall.. gavity wins ultimately, unless u tweak the velocity....
test it out at quake.intertex.net i have a mod running that has wall jumps...![Smile :)](./images/smilies/icon_smile.gif)
.float timetojump2;
If i just hold +jump it doesnt keep jumping....
the time delay on the second limits the space between initial jump off ground to contact with wall.. gavity wins ultimately, unless u tweak the velocity....
test it out at quake.intertex.net i have a mod running that has wall jumps...
![Smile :)](./images/smilies/icon_smile.gif)
r00k wrote:the time delay on the second limits the space between initial jump off ground to contact with wall.. gavity wins ultimately, unless u tweak the velocity....
test it out at quake.intertex.net i have a mod running that has wall jumps...
ahhhhhhh ok.... your description, example code and my connecting to your server at quake.internex.net have helped me understand this concept in great detail.
For this you have my humble thanks!
So I thought I had it figured out, but it seems like people are having trouble....
I've tested this in darkplaces-glx, tyr-glquake, and tyr-quake and it seems to work fine:
Can anyone try this and verify whether or not the wall jumping works?
http://harbl.iiichan.net/MMX.zip
I noticed that when running forward like the normal quake guy and trying to catch the wall jump from the side while moving forward doesn't work - as intended. You kind of have to be constantly pressing into the wall.
It works from a standing start or a moving start if once you hit the wall you move into the wall while jumping repeatedly. This is of course still a work in progress
I've tested this in darkplaces-glx, tyr-glquake, and tyr-quake and it seems to work fine:
Can anyone try this and verify whether or not the wall jumping works?
http://harbl.iiichan.net/MMX.zip
I noticed that when running forward like the normal quake guy and trying to catch the wall jump from the side while moving forward doesn't work - as intended. You kind of have to be constantly pressing into the wall.
It works from a standing start or a moving start if once you hit the wall you move into the wall while jumping repeatedly. This is of course still a work in progress