function for changing diagonals. help pls

GPC2 script programming for Titan Two. Code examples, questions, requests.

function for changing diagonals. help pls

Postby manx » Sun Sep 29, 2019 4:13 pm

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!
User avatar
manx
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Sun Sep 29, 2019 4:05 pm

Re: function for changing diagonals. help pls

Postby J2Kbr » Mon Sep 30, 2019 1:00 pm

Hi, Are you using mouse? If yes you can compensate this behavior by adjusting the Diagonal Dampening parameter (DD Factor).
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: function for changing diagonals. help pls

Postby manx » Mon Sep 30, 2019 2:12 pm

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.
User avatar
manx
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Sun Sep 29, 2019 4:05 pm

Re: function for changing diagonals. help pls

Postby manx » Mon Sep 30, 2019 3:30 pm

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.
User avatar
manx
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Sun Sep 29, 2019 4:05 pm

Re: function for changing diagonals. help pls

Postby J2Kbr » Wed Oct 02, 2019 9:46 am

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.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: function for changing diagonals. help pls

Postby dan_94 » Sat Oct 05, 2019 3:54 pm

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
User avatar
dan_94
Master Sergeant
Master Sergeant
 
Posts: 28
Joined: Sat Aug 11, 2018 6:07 am

Re: function for changing diagonals. help pls

Postby J2Kbr » Sun Oct 13, 2019 6:27 pm

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.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: kubawaz and 126 guests