Analogue look left/right/up/down auto center solution.

Make your game even better
User avatar
JHTrucker
Expert
Posts: 1356
Joined: February 7th, 2020, 3:19 pm
Location: UK

Analogue look left/right/up/down auto center solution.

Post by JHTrucker » June 8th, 2020, 1:58 pm

Analogue look left/right/up/down auto center solution - works for interior driving view only (cam 1).
Note: g_cam_window_block doesn't work when using the auto center option. Button look options don't auto center.

You can enable this auto center option in game to swap between the standard camera movement that doesn't auto center and this one.
Example: Drive to the destination using auto center option and then switch to standard whilst maneuvering into the parking position.

Setup controller as normal in game, like so.
OPTIONS - CONTROLLERS - Keyboard+Controller
Pick your "Look up/down axis" & "Look left/right axis"
Adjust deadzones & axis mode as required.

Make a backup copy of controls.sii for safe keeping, just in case.
(American/Euro Truck Simulator 2\profiles\Your Profile\controls.sii)

Now edit with notepad your controls.sii file:

Do this for game version 1.38+ only (1.37 further down):
Change the following lines (line numbers correct for game version 1.38/1.39/1.40):
config_lines[250]: "mix headtron `c_ht_on`"
config_lines[251]: "mix headtryaw `deadzone(-sel(c_jilooklr, -j_look_lr?0, j_look_lr?0), c_lr_dz)`"
config_lines[252]: "mix headtrpitch `deadzone(-sel(c_jilookud, -j_look_ud?0, j_look_ud?0) / 2, c_ud_dz)`"

Close and save

In game go to Options - keys & buttons - other - "Enable head tracking" - assign a key. New feature added to 1.38, thanks SCS.
I assigned to my xbox360 "press right stick button", so i have both look options contained on one stick.
In game, you enable or disable auto center option by pressing that assigned key to toggle enable or disable. No menu mod required!

If the view seems twitchy when centered, increase left/right and/or up/down deadzone in game options.
If you feel the left/right & up/down motion is too quick / sensitive then try replacing lines 251 & 252 with these two lines that are smoothed / less sensitive around the center point:
config_lines[251]: "mix headtryaw `deadzone(pow(-sel(c_jilooklr, -j_look_lr?0, j_look_lr?0), 3), c_lr_dz)`"
config_lines[252]: "mix headtrpitch `deadzone(pow(-sel(c_jilookud, -j_look_ud?0, j_look_ud?0), 3), c_ud_dz)`"

If you'd rather keep the auto center view restricted to inside the cab only, to not cheat when using g_cam_window_block with the standard view, then here's two options:
Replace line 251 with this line to restrict left/right to 90 degrees using quick motion:
config_lines[251]: "mix headtryaw `deadzone(-sel(c_jilooklr, -j_look_lr?0, j_look_lr?0), c_lr_dz) / 2`"
OR
Replace line 251 with this line to restrict left/right to 90 degrees using smoothed motion:
config_lines[251]: "mix headtryaw `deadzone(pow(-sel(c_jilooklr, -j_look_lr?0, j_look_lr?0), 3), c_lr_dz) / 2`"

Here's a graph of what the original quick motion & smoothed motion looks like.
quick or smooth.png
Quick look back view for head tracking or my Analogue look left/right/up/down auto center solution - ATS & ETS2 1.38.
viewtopic.php?p=28304#p28304

======================================================================================================

If you want to use 'button look' instead of analogue gamepad then look at this, info provided by forum member danilozxf:
Demo video: viewtopic.php?p=28579#p28579
Download link: viewtopic.php?p=28585#p28585

======================================================================================================

Do this for game version 1.37 only:
Change the following lines (line numbers correct for game version 1.37):
config_lines[243]: "mix headtron `c_et_head`"
config_lines[244]: "mix headtryaw `deadzone(-sel(c_jilooklr, -j_look_lr?0, j_look_lr?0), c_lr_dz)`"
config_lines[245]: "mix headtrpitch `deadzone(-sel(c_jilookud, -j_look_ud?0, j_look_ud?0) / 2, c_ud_dz)`"

Close and save

In game, you enable or disable auto center option by doing the following:
Enable - Console type c_et_head 1 enter close console.
Disable - Console type c_et_head 0 enter close console.

Or use the attached mod for ATS/ETS2 1.37 to tick and untick auto center as required.
Warning: Your game will crash if you use this mod with 1.38!!!
Auto Center Menu.zip
Auto Center Menu.png
Press SHIFT + NUMLOCK to access the modified menu (Eye Tracking Menu).
Press ESCAPE to go back to driving view.

If the view seems twitchy when centered, increase left/right and/or up/down deadzone in game options.

If you feel the left/right & up/down motion is too quick / sensitive then try replacing lines 244 & 245 with these two lines that are smoothed / less sensitive around the center point:
config_lines[244]: "mix headtryaw `deadzone(pow(-sel(c_jilooklr, -j_look_lr?0, j_look_lr?0), 3), c_lr_dz)`"
config_lines[245]: "mix headtrpitch `deadzone(pow(-sel(c_jilookud, -j_look_ud?0, j_look_ud?0), 3), c_ud_dz)`"

If you'd rather keep the auto center view restricted to inside the cab only, to not cheat when using g_cam_window_block with the standard view, then here's two options:
Replace line 244 with this line to restrict left/right to 90 degrees using quick motion:
config_lines[244]: "mix headtryaw `deadzone(-sel(c_jilooklr, -j_look_lr?0, j_look_lr?0), c_lr_dz) / 2`"
OR
Replace line 244 with this line to restrict left/right to 90 degrees using smoothed motion:
config_lines[244]: "mix headtryaw `deadzone(pow(-sel(c_jilooklr, -j_look_lr?0, j_look_lr?0), 3), c_lr_dz) / 2`"

======================================================================================================

Original 1.37 controls.sii file unedited lines, should you require them:
config_lines[53]: "constant c_et_head 1.000000"
config_lines[243]: "mix headtron `trackiron | hmdon | eyeposon`"
config_lines[244]: "mix headtryaw `sel(trackiron, trackiryaw, 0) + sel(hmdon, hmdyaw, 0) + sel(eyeposon, eyeposyaw, 0)`"
config_lines[245]: "mix headtrpitch `sel(trackiron, trackirpitch, 0) + sel(hmdon, hmdpitch, 0) + sel(eyeposon, eyepospitch, 0)`"

Original 1.38/1.39/1.40 controls.sii file unedited lines, should you require them:
config_lines[250]: "mix headtron `c_ht_on & (trackiron | hmdon | eyeposon)`"
config_lines[251]: "mix headtryaw `sel(trackiron, trackiryaw, 0) + sel(hmdon, hmdyaw, 0) + sel(eyeposon, eyeposyaw, 0)`"
config_lines[252]: "mix headtrpitch `sel(trackiron, trackirpitch, 0) + sel(hmdon, hmdpitch, 0) + sel(eyeposon, eyepospitch, 0)`"
Last edited by JHTrucker on August 23rd, 2022, 4:02 pm, edited 26 times in total.
multimon_config.sii files: viewtopic.php?p=17658#p17658
controls.sii edits: viewtopic.php?p=24744#p24744
TrackIR Driving Enhancements: viewtopic.php?p=46613#p46613
Extra Cameras: viewtopic.php?p=46034#p46034
User avatar
JHTrucker
Expert
Posts: 1356
Joined: February 7th, 2020, 3:19 pm
Location: UK

Re: Analogue look left/right/up/down auto center solution

Post by JHTrucker » June 8th, 2020, 9:20 pm

First post updated to include a "smoothed motion" option.
multimon_config.sii files: viewtopic.php?p=17658#p17658
controls.sii edits: viewtopic.php?p=24744#p24744
TrackIR Driving Enhancements: viewtopic.php?p=46613#p46613
Extra Cameras: viewtopic.php?p=46034#p46034
User avatar
JHTrucker
Expert
Posts: 1356
Joined: February 7th, 2020, 3:19 pm
Location: UK

Re: Analogue look left/right/up/down auto center solution

Post by JHTrucker » June 9th, 2020, 6:15 pm

First post updated to include a restricted cab view option for auto center view only.
multimon_config.sii files: viewtopic.php?p=17658#p17658
controls.sii edits: viewtopic.php?p=24744#p24744
TrackIR Driving Enhancements: viewtopic.php?p=46613#p46613
Extra Cameras: viewtopic.php?p=46034#p46034
User avatar
JHTrucker
Expert
Posts: 1356
Joined: February 7th, 2020, 3:19 pm
Location: UK

Re: Analogue look left/right/up/down auto center solution

Post by JHTrucker » June 18th, 2020, 7:18 pm

First post updated to include a menu mod to make auto center enable/disable easier to use.
multimon_config.sii files: viewtopic.php?p=17658#p17658
controls.sii edits: viewtopic.php?p=24744#p24744
TrackIR Driving Enhancements: viewtopic.php?p=46613#p46613
Extra Cameras: viewtopic.php?p=46034#p46034
User avatar
JHTrucker
Expert
Posts: 1356
Joined: February 7th, 2020, 3:19 pm
Location: UK

Re: Analogue look left/right/up/down auto center solution

Post by JHTrucker » June 22nd, 2020, 2:18 pm

If you are using this on ATS 1.38 with the menu mod... does the mod still work ok?
I'm staying on 1.37 until after public release.
Thanks.
multimon_config.sii files: viewtopic.php?p=17658#p17658
controls.sii edits: viewtopic.php?p=24744#p24744
TrackIR Driving Enhancements: viewtopic.php?p=46613#p46613
Extra Cameras: viewtopic.php?p=46034#p46034
User avatar
JHTrucker
Expert
Posts: 1356
Joined: February 7th, 2020, 3:19 pm
Location: UK

Re: Analogue look left/right/up/down auto center solution

Post by JHTrucker » June 24th, 2020, 6:51 pm

First post updated to my "best guess" for game version 1.38, no menu mod or console commands required!
multimon_config.sii files: viewtopic.php?p=17658#p17658
controls.sii edits: viewtopic.php?p=24744#p24744
TrackIR Driving Enhancements: viewtopic.php?p=46613#p46613
Extra Cameras: viewtopic.php?p=46034#p46034
User avatar
danilozxf
PPM
Posts: 44
Joined: July 29th, 2020, 12:19 am

Re: Analogue look left/right/up/down auto center solution 1.37 & 1.38

Post by danilozxf » September 4th, 2020, 12:28 am

Hi @JHTrucker

Would centralization be possible by pressing a joystick button? For example in the video below I look to the right to the point I want and press the B button to center (xbox one control), but the movement is too fast, it would be possible to make the smoothing to center.



I don't want it to center automatically, but that when I press button B the movement will be smooth.
System: Windows 10
Processor: Ryzen 5 3600
Memory: 16GB
Graphics: Gigabyte RTX 2070 3 Fans
https://www.youtube.com/channel/UCu7qwY ... 0uw/videos
User avatar
BenganJ
Moderator
Posts: 9589
Joined: December 15th, 2018, 11:54 am
Location: Gothenburg, Sweden

Re: Analogue look left/right/up/down auto center solution 1.37 & 1.38

Post by BenganJ » September 4th, 2020, 12:32 am

@danilozxf

Why not using headtracking instead? Then the view will follow your headmovement!
---------------------------------------------------------------------------------------------------------------------------------------------
System: Windows 8.1
Processor: Intel Core i7-4790@
Memory: 16GB
Graphics: ASUS GeForce GTX1660Ti
Image
User avatar
danilozxf
PPM
Posts: 44
Joined: July 29th, 2020, 12:19 am

Re: Analogue look left/right/up/down auto center solution 1.37 & 1.38

Post by danilozxf » September 4th, 2020, 1:42 am

Hi @BenganJ

No, I do not use headtracking

Xbox one joystick only

Here in Brazil it is difficult to find, and import at that moment it is not viable for the value of the dollar
System: Windows 10
Processor: Ryzen 5 3600
Memory: 16GB
Graphics: Gigabyte RTX 2070 3 Fans
https://www.youtube.com/channel/UCu7qwY ... 0uw/videos
User avatar
JHTrucker
Expert
Posts: 1356
Joined: February 7th, 2020, 3:19 pm
Location: UK

Re: Analogue look left/right/up/down auto center solution 1.37 & 1.38

Post by JHTrucker » September 4th, 2020, 1:48 am

@danilozxf
If you are using the auto centre settings, then it just uses your game pad joystick to control the view like head tracking does (same inputs).
Where the joystick is moved to is where the on screen view is. I can't make the view move on it's own, back to centre.
multimon_config.sii files: viewtopic.php?p=17658#p17658
controls.sii edits: viewtopic.php?p=24744#p24744
TrackIR Driving Enhancements: viewtopic.php?p=46613#p46613
Extra Cameras: viewtopic.php?p=46034#p46034
Post Reply