Joystick Curves made easy
6 posts
• Page 1 of 1
Joystick Curves made easy
This simple function gives a nice curve, slow near the center.
Wonder if anyone had this or something similar? If not, enjoy.
Wonder if anyone had this or something similar? If not, enjoy.
- Code: Select all
main {
Curves(PS4_RX);
Curves(PS4_LX);
}
void Curves (uint8 axis)
{
fix32 R = pow(abs(get_val(axis)), 2.0) / 100.0;
if(get_actual(axis) < 00.00 ) R = -R;
set_val(axis, R);
}
Last edited by thedude on Thu Aug 01, 2019 5:35 pm, edited 1 time in total.
-
thedude - Staff Sergeant
- Posts: 12
- Joined: Wed Apr 10, 2019 8:09 pm
Re: Joystick Curves made easy
Nice, thank you for sharing. If you haven't yet, please also consider publish your script on Gtuner IV Online Resources.
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Joystick Curves made easy
It is published as a function in my recent contribution:
https://www.consoletuner.com/greslib/?0&F&0&1&&dmlycGls
Changed the curve to use multiplication, because the power function takes so much more cpu time.
https://www.consoletuner.com/greslib/?0&F&0&1&&dmlycGls
Changed the curve to use multiplication, because the power function takes so much more cpu time.
- Code: Select all
void Curves (uint8 axis)
{
// power works and can be used for different curves, but it is slow
//fix32 R = pow(abs(get_val(axis)), 2.0) / 100.0;
// multiplication is about 18 times faster, great if using power of 2.
fix32 axisval = get_actual(axis);
fix32 R = axisval * axisval / 100.0;
if(axisval < 00.00 ) R = -R;
set_val(axis, R);
}
-
thedude - Staff Sergeant
- Posts: 12
- Joined: Wed Apr 10, 2019 8:09 pm
Re: Joystick Curves made easy
What's does do this script
-
teddy18 - Lieutenant
- Posts: 346
- Joined: Sun Jul 19, 2015 4:18 pm
Re: Joystick Curves made easy
It applies an exponential transformation, making the movements near the center position less sensitive and near the edges more sensitive.
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
6 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: A pile of bricks and 198 guests