Page 1 of 1

function for changing diagonals. help pls

PostPosted: Sun Sep 29, 2019 4:13 pm
by manx
Hi guys!

I do have the problem, that some games (Destiny 2!!!!) have much faster diagonals than normal x and y axis. I do have a deadzone remove function, that can change between circle and square. But in both cases, the diagonals are faster than normal x and y axis. I would like to have a function that compensates something like this. I know i have to try it out in destiny for the right numbers, but i really don't know how to write a good function for this.

King regards!

Re: function for changing diagonals. help pls

PostPosted: Mon Sep 30, 2019 1:00 pm
by J2Kbr
Hi, Are you using mouse? If yes you can compensate this behavior by adjusting the Diagonal Dampening parameter (DD Factor).

Re: function for changing diagonals. help pls

PostPosted: Mon Sep 30, 2019 2:12 pm
by manx
No I am using a controller. I know that there is an option in the input translator, but i can't you this with the controller.

Re: function for changing diagonals. help pls

PostPosted: Mon Sep 30, 2019 3:30 pm
by manx
a x to y relationship isn't the right way I think. maybe with sin oder cos function or to change the deadzone to an other form.

Re: function for changing diagonals. help pls

PostPosted: Wed Oct 02, 2019 9:46 am
by J2Kbr
Here is a GPC function to apply diagonal dampening to regular stick inputs (right stick).
Code: Select all
void DiagonalDampening(fix32 DD) {
    static fix32 px, py, rx, ry;
    fix32 fx = get_actual(STICK_1_X);
    fix32 fy = get_actual(STICK_1_Y);
 
    if(fx != px || fy != py) {
        px = fx; py = fy;
 
        fix32 fsx;
        if(fx > 0.0) { fsx = 1.0; }
        else if(fx < 0.0) { fsx = -1.0; }
        else fsx = 0.0;
 
        fix32 fsy;
        if(fy > 0.0) { fsy = 1.0; }
        else if(fy < 0.0) { fsy = -1.0; }
        else fsy = 0.0;
 
        fx = abs(fx);
        fy = abs(fy);
 
        fix32 a = atan2(fy, fx);
        fix32 cos_a = cos(a);
        fix32 sin_a = sin(a);
        fix32 dd = 1.0 - ((1.0 - abs(sin_a - cos_a)) * DD);
 
        fx *= dd;
        fy *= dd;
 
        rx = clamp(fx, 0.0, 100.0) * fsx;
        ry = clamp(fy, 0.0, 100.0) * fsy;
    }
    set_val(STICK_1_X, rx);
    set_val(STICK_1_Y, ry);
    return;
}

calling this function with argument 1.0 is the same as not apply any diagonal dampening, values below 1.0 reduces the diagonal sensitivity.

Re: function for changing diagonals. help pls

PostPosted: Sat Oct 05, 2019 3:54 pm
by dan_94
i dont get it to work.
i think i dont know how to call it with argument???
Could you share how to do it?
Thanks in advance
Greetings

Re: function for changing diagonals. help pls

PostPosted: Sun Oct 13, 2019 6:27 pm
by J2Kbr
dan_94 wrote:i dont get it to work. i think i dont know how to call it with argument??? Could you share how to do it? Thanks in advance Greetings

Please post the script your tried use this function, so we can help with it. thanks.