Announcement

Collapse
No announcement yet.

Some help with the walljumping

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some help with the walljumping

    Hello all,

    As some of you saw, I have made a post giving an example of my current walljumping code in action. There is actually a blaring problem with it that I cannot solve, and that is jumping of of walls that are not at a 90 degree angle to ranger's hitbox. This is simply because of the fact that ranger has a square hitbox, where the length from corner to corner is longer than it is side to side. I tried to come up with a method to compensate, which involved a cosine function. Sadly, this didn't seem to work at all.

    Only if rangers hitbox was either cylindrical or rotated with his view, this would not be a problem. Because of this issue, I am going to ask here if there is a better solution.

    Here is my current function that checks for the walljump:

    Code:
    void () wjcheck =
    {
    	local	vector vecm;
    	local	vector vecr;
    	local	vector vecl;
    	
    	makevectors(self.angles);
    	
    	traceline (self.origin, (self.origin + (v_forward * -41)), FALSE, self); // draw traceline from the center of ranger
    	vecm = trace_endpos;
    	traceline (self.origin, (self.origin + (v_right * 12) + (v_forward * -41)), FALSE, self); // draw traceline from 12 units from the center of ranger
    	vecr = trace_endpos;
    	traceline (self.origin, (self.origin + (v_right * -12) + (v_forward * -41)), FALSE, self); // draw traceline from -12 units from the center of ranger
    	vecl = trace_endpos;
    	
    	if (vlen(vecm - self.origin) <= 40 || vlen(vecr - self.origin) <= 40 || vlen(vecl - self.origin) <= 40)
    	{
    		self.wjump = 1;
    	}
    	else
    	{
    		self.wjump = 0;
    	}
    };
    The reason why I need this fixed is because the minimum angle needed to walljump changes depending on the angle of the wall. This is, again, because of the hitbox.

  • #2
    use tracebox instead.

    failing that if you're using a shit engine:
    vector leadingcorner = self.origin + [self.velocity_x>0?self.maxs_x:self.maxs_x,self.vel ocity_y>0?self.maxs_y:self.mins_y,self.velocity_z> 0?self.maxs_z:self.mins_z];
    then traceline outwards from that corner. or something. but yeah, tracebox is better.
    Some Game Thing

    Comment


    • #3
      Originally posted by Spike View Post
      use tracebox instead.

      failing that if you're using a shit engine:
      vector leadingcorner = self.origin + [self.velocity_x>0?self.maxs_x:self.maxs_x,self.vel ocity_y>0?self.maxs_y:self.mins_y,self.velocity_z> 0?self.maxs_z:self.mins_z];
      then traceline outwards from that corner. or something. but yeah, tracebox is better.
      What the fuck is that syntax? I have no idea what that is.

      Also, give an example of how to use tracebox.
      Last edited by SpecialBomb; 10-03-2016, 03:39 PM.

      Comment


      • #4
        //DP_QC_TRACEBOX
        //idea: id Software
        //darkplaces implementation: id Software
        //builtin definitions:
        void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
        //description:
        //similar to traceline but much more useful, traces a box of the size specified (technical note: in quake1 and halflife bsp maps the mins and maxs will be rounded up to one of the hull sizes, quake3 bsp does not have this problem, this is the case with normal moving entities as well).

        I don't QuakeC but there's DarkPlaces tracebox QuakeC extension.

        Spike used C language notation where "?" means "IF" and ":" means "ELSE"

        self.velocity_x > 0 ? self.maxs_x : self.velocity_y

        ^^
        becomes

        if self.velocity_x > 0 then self.maxs_x else self.velocity_y
        Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

        So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

        Comment

        Working...
        X