left analoge
4 posts
• Page 1 of 1
left analoge
hi, im looking for a little script for titan two that the anologue stick will only move at 1 speed no matter how fast or slow i move it. i need to be able to mess around with the variable so i can determine the speed i need. also if poss the anologe stick to move as soon as i touch it(if thats possible at all) many thanks
-
peter373635 - Sergeant
- Posts: 7
- Joined: Mon Nov 23, 2020 9:18 am
Re: left analoge
- Code: Select all
//CHANGE THESE VALUES
fix32 deadzoneL = 0.00;
fix32 sensitivityL = 100.00;
main {
applySticks(deadzoneL, sensitivityL);
}
void applySticks(fix32 dead, fix32 sens){
fix32 x, y;
x = get_val(STICK_2_X);
y = get_val(STICK_2_Y);
fix32 magnitude = sqrt(x*x + y*y);
fix32 outX = x/magnitude;
fix32 outY = y/magnitude;
if(magnitude > dead){
outX = clamp(outX*sens, -100.00, 100.0);
outY = clamp(outY*sens, -100.00, 100.00);
set_val(STICK_2_X, outX);
set_val(STICK_2_Y, outY);
}
else{
set_val(STICK_2_X, 0.0);
set_val(STICK_2_Y, 0.0);
}
}
Keeps distance at whatever the sensitivity is set to regardless of angle. Use 0.00 to 100.00 values to customize either value.
100.0 sensitivity is "max" sensitivity, 0.00 is no movement.
This triggers with any movement, but I'd recommend setting a modest deadzone because small movements can output dramatic angle differences.
-
EternalDahaka - Staff Sergeant
- Posts: 15
- Joined: Tue Feb 23, 2016 7:12 am
Re: left analoge
superb,thanks..will try it in a bit
-
peter373635 - Sergeant
- Posts: 7
- Joined: Mon Nov 23, 2020 9:18 am
Re: left analoge
hi, i tried it but controller not working like a normal controller with this code. not sure why but thanks for trying anyway,not sure why because even with inputs at 100% its acting weird. thanks for trying tho
-
peter373635 - Sergeant
- Posts: 7
- Joined: Mon Nov 23, 2020 9:18 am
4 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 102 guests