[Help] PS4 SIXAXIS as stick Aiming

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

[Help] PS4 SIXAXIS as stick Aiming

Postby lavaga123 » Wed Apr 17, 2019 8:14 pm

Hello everybody!

I'm new on the forums and a recently owner of a T2 device, I always tought that there was no such thing and that EVERYONE on console gaming was playing fairly untill I found "tha wae" of our beloved queen, the T2. I have searched arround the forum and basicly just got to a dead end... I only got a post stating "its doable with a script" but no script or additional info was provided.

My request:

I want to play shooting games that uses the right stick (correct me if I'm wrong but I believe its called "Sitck 1") to aim with motion/gyro or however it's called since everyone seems to call it differently. No, I don't want Splatoon Gyro controlls, I am more interested on the Paladins for PS4 kind of controlls. In Paladins I can use movement of the DS4 controller to aim assist my Right Stick aiming, thats exactly what I'm looking foward to but... for Uncharted 4. Yes... not much people care about motion controllers for Uncharted 4... I havent seen anyone asking for i or even implementing it on the gamepacks even tho someone implemented it on the The Last of Us gmepack.

Before you tell me that the one from TLoU ca be used for Uncharted 4... I tried it, deeply tested it and nooooo... not good at all. It BARELY moves or helps at all. Please forum, help me out in any way possible... This could help so many people, alot of people I personally know are enjoying motion conrollers more and more each day, that's a new gen of gamers we're helping out, not just me.

Thanks for reading all this so far, any help is appreciated greatly. :joia: :smile0201:
User avatar
lavaga123
Corporal
Corporal
 
Posts: 5
Joined: Wed Apr 17, 2019 7:42 pm

Re: [Help] PS4 SIXAXIS as stick Aiming

Postby J2Kbr » Thu Apr 18, 2019 2:23 pm

Welcome to our forums.

I started code the request script but turned out, for best results, it will require more than a simple mapping of the accelerometers values to the right stick (need also take in consideration the game deadzone). I will continue working on this during the weekend, while playing the game.

In the mean time, please let me know if would be enough have the motion aiming assist enabled only while ADSing (scoping). 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

Re: [Help] PS4 SIXAXIS as stick Aiming

Postby lavaga123 » Mon Apr 22, 2019 10:42 pm

Thanks for having the time to read and start investing your time on my request, I honestly tought it was going to be ignored since most people dont care about motion controllers.

To answer your question, I do prefer it to be as you mentioned, it would feel more "natural" than just havong it on all the time. If theres more questions let me know, I'll be more attentive to the post replies more since easter ended. Thanks fam :smile0201:
User avatar
lavaga123
Corporal
Corporal
 
Posts: 5
Joined: Wed Apr 17, 2019 7:42 pm

Re: [Help] PS4 SIXAXIS as stick Aiming

Postby J2Kbr » Wed Apr 24, 2019 2:01 pm

Here is an script to convert the controller motion to stick movement. It is activated only when pressing the aiming button (L2). You may need tweak the values at the #defines for the game you are playing. :smile0517:
Code: Select all
#pragma METAINFO("Motion Aiming", 1, 0, "J2Kbr")
 
#define SENSITIVITY_X   5.0
#define SENSITIVITY_Y   5.0
 
#define DEADZONE_X      20.0
#define DEADZONE_Y      20.0
#define DEADZONE_D      1.0
 
main {
    if(get_val(BUTTON_8)) {
        static fix32 offset_x;
        static fix32 offset_y;
        if(event_active(BUTTON_8)) {
            offset_x = get_val(ACCEL_1_X);
            offset_y = get_val(ACCEL_1_Y);
        }
        if(abs(get_val(STICK_1_X)) <= DEADZONE_X && abs(get_val(STICK_1_Y)) <= DEADZONE_Y) {
            motion_aiming(offset_x, offset_y);
        }
    }
}
 
void motion_aiming(fix32 offset_x, fix32 offset_y) {
    static fix32 accel_x, accel_y;
    static fix32 stick_x, stick_y;
    if(accel_x != get_actual(ACCEL_1_X) || accel_y != get_actual(ACCEL_1_Y)) {
        accel_x = get_actual(ACCEL_1_X);
        accel_y = get_actual(ACCEL_1_Y);
        stick_x = (accel_x - offset_x) * SENSITIVITY_X;
        stick_y = (accel_y - offset_y) * SENSITIVITY_Y;
 
        fix32 signal_x = (stick_x < 0.0) ? (stick_x = inv(stick_x), -1.0) : (stick_x > 0.0) ? 1.0 : 0.0;
        fix32 signal_y = (stick_y < 0.0) ? (stick_y = inv(stick_y), -1.0) : (stick_y > 0.0) ? 1.0 : 0.0;
        fix32 angle = atan2(stick_y, stick_x);
 
        stick_x = clamp(((DEADZONE_X * pow(cos(angle), DEADZONE_D)) + stick_x) * signal_x, -100.0, 100.0);
        stick_y = clamp(((DEADZONE_Y * pow(sin(angle), DEADZONE_D)) + stick_y) * signal_y, -100.0, 100.0);
    }
    set_val(STICK_1_X, stick_x);
    set_val(STICK_1_Y, stick_y);
    return;
}
 
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: [Help] PS4 SIXAXIS as stick Aiming

Postby IX_TASTY_XI » Wed May 01, 2019 5:23 am

I believe people find gyro controls good for aiming because it’s typically implemented as a pointing device. In general a pointing device is going to offer more precision than a rate control device. A common example of a pointing device and a rate control device is a mouse and a joystick, respectively.

What would be really cool is if you could program the gyro controls to use the mouse translator, which would make the gyro controls behave like a pointing device. If this were possible you could potentially get accuracy compared to this player who is using a steam controller with gyro controls acting like a pointing device (not me btw):

https://youtu.be/WKKRVds3YrA
User avatar
IX_TASTY_XI
Sergeant First Class
Sergeant First Class
 
Posts: 24
Joined: Sun Oct 29, 2017 8:01 pm

Re: [Help] PS4 SIXAXIS as stick Aiming

Postby Scachi » Fri May 03, 2019 5:37 pm

J2Kbr wrote:Here is an script to convert the controller motion to stick movement. It is activated only when pressing the aiming button (L2). You may need tweak the values at the #defines for the game you are playing. :smile0517:

Are you sure the lines are working correctly ? That is giving me odd values without moving the controller at all.
Code: Select all
stick_x = clamp(((DEADZONE_X * pow(cos(angle), DEADZONE_D)) + stick_x) * signal_x, -100.0, 100.0);
        stick_y = clamp(((DEADZONE_Y * pow(sin(angle), DEADZONE_D)) + stick_y) * signal_y, -100.0, 100.0);

When I remove DEADZONE_X DEADZONE_Y from those line it is working the way I would have expected it to do.

Not sure what deadzone is meant to do. _X and _Y stops the motion aim from kicking in when the sticks are moved manually > Deadzone.
But why adding it to the stick_ lines mentioned above, what is the idea of doing this ?
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: [Help] PS4 SIXAXIS as stick Aiming

Postby lavaga123 » Fri May 17, 2019 12:07 am

As the previous person states, is kinda filmsy.. cant seem to get it to work even playing with the settings. Is kinda rough to aim with it but its definetly a great start. I have been reading alot but nohing comes to me as an idea to improve it
User avatar
lavaga123
Corporal
Corporal
 
Posts: 5
Joined: Wed Apr 17, 2019 7:42 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: Majestic-12 [Bot] and 88 guests