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:
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.
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; } };
Comment