[REL] HeadTilt Plugin

Discussion in 'Other' started by Lazza, Apr 21, 2015.

  1. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    HeadTilt Plugin v1.1 30th April 2015

    This is a small plugin for altering the cockpit camera angle/position per-class, and optionally per car in that class. Each class (or vehicle) setting is saved and restored when you enter that car.

    Download:
    https://www.dropbox.com/s/ubajbm049tdqmxh/Install_HeadTilt_Plugin_V1_1.zip?dl=0


    Installation: Extract and run the zipped .exe file and follow the instructions. The installer will ask for Administrator access in case your rF2 folder requires those permissions.

    Alternatively you can extract the .dll files manually (they're in the archive) but please put them in the right place :)


    Usage:

    Start rF2, then quit out and check your Userdata\<player> folder for a HeadTilt_Plugin.ini file (not there? Check the plugin installation) Some basic settings will have been written including the "MenuKey" which is Y by default. This is the key you need to press to bring up the HeadTilt 'menu' when in the car.

    Menu navigation and the angle adjustment is done via the rF2 'pitmenu' controls. So whatever buttons/keys you use to move up/down in the pitmenu, and increase/decrease values (like fuel, or tyre compounds) will be used to 'move' up/down/right/left.

    Note: For simplicity I've used the Message Center to show what the plugin is doing. Most of the time this works fine but if it keeps displaying the same message a few times rF2 will no longer update it. If you wait a few seconds all the previous messages will 'time out' and you'll be able to see what you're doing again.

    Main Menu:

    When you press the HeadTilt menu key, you'll have these options you can cycle through with the up/down controls:
    - Adjust class
    - Adjust vehicle
    - Clear vehicle setting (only available when you've already got a vehicle-specific setting)

    Pressing 'right' on any option will enter that option. Pressing HeadTilt will exit the menu.


    Adjustment:

    Having entered the class or vehicle adjustment, you use the up/down and optionally the left/right controls to move the view around by changing the camera angle.

    Optionally:
    Holding Shift while adjusting will change the camera X (left-right) and Z (forward-back) position.
    Holding Alt while adjusting will change the camera Y (up-down) position, and the Roll angle. (roll isn't very useful, and doesn't quite work how you might think)

    Press HeadTilt to save the setting.

    As per the note earlier, if you move back through previous settings quite quickly rF2 will stop writing the messages. If you're moving and it's not saying anything, just wait a few seconds for all the messages to turn grey, then it will start showing the current angle again when you move.


    Class vs vehicle:

    Your current vehicle class is shown in the expanded timings screen. Usually a single class includes a number of different cars, quite often physically identical. This means a single class-wide adjustment will be enough.

    Sometimes a particular car may have a different camera setting, or actually be a different physical design. In this case you can adjust the vehicle-specific setting which will only affect that vehicle. 'Vehicle' is based on the defined vehicle text for the car; upgrades won't affect it unless they also affect the vehicle class, while multiple cars in the same team will be considered different vehicles even though they're almost certainly physically identical.


    Clearing a vehicle setting:

    The third main menu option, which will be available when you're in a car with a vehicle-specific HeadTilt setting, is used to stop the current vehicle having its own setting that overrides the class setting. The default option in the clear vehicle menu is Cancel, so press up/down to select confirmation and then press 'right' again to clear the setting. The view will revert to the class setting.


    Extra configuration:

    The HeadTilt_Plugin.ini file in your player folder is where all the class and vehicle settings are stored. At the top are a few extra settings you may want to adjust; for example you can alter how much the angle changes per input press. Note that all angles are expressed in degrees * 1000, so the smallest increment is 0.001°.


    Issues:

    - The displayed angles will be correct with the default Glance (left/right) and Look Up/Down angles, which are 0.75 and 0.4 respectively. If you change those values in your player.JSON the actual angles will change accordingly. For example: if you double the default glance angle, you'll be looking 90° left or right when the plugin says 45°.
    - The position numbers don't have proper units. I haven't looked at what 1.0 actually means, but it's definitely less than a metre (likely a player.JSON or controller.JSON setting is affecting this).
    - Not all cameras will let you adjust the angle or position. The 'driving' views, which you can cycle through using Insert, are usually ok. The various car mounted cameras, chasecam, etc, usually don't respond to angle changes but the position can often be changed.
    - The plugin disables itself when you're not in the car in realtime. Cockpit replays at the monitor will not look the same as when you're driving, but this is a better option than making some camera angles unusable because the plugin keeps moving the camera. For the same reason the plugin will also disable itself when you toggle FreeLook.
    - By default the plugin won't switch off when you 'Disable Hardware Plugins'. You can change this in the .ini.
    Toggling FreeLook and HardWare Plugins in combination can lead to the plugin getting confused and applying its settings when it shouldn't. You have been warned :)
    - If different mods use the same class text the plugin won't be able to tell them apart. Adjusting the vehicle-specific setting should get around this most of the time, because it's unlikely that both the class and vehicle descriptions will be identical.
    - If a car class or vehicle description ends in 'orientation' it could lead to problems with different vehicles reading the wrong settings. This is unlikely.

    Todo:

    I may look into trying to read the player.JSON to compensate for non-standard glance/look angles, but this is low priority. People changing those values should be able to compensate for it themselves.


    Please let me know if you have problems or (simple!) suggestions. Take a couple of minutes to get used to the menu navigation though - it does make sense once you get the hang of it.
     
    Last edited: Mar 17, 2017
  2. MystaMagoo

    MystaMagoo Registered

    Joined:
    Oct 5, 2010
    Messages:
    775
    Likes Received:
    4
    Can you make a zip file also?
     
  3. MaD_King

    MaD_King Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,827
    Likes Received:
    611
    Could you make screen/drawing, I'm not sure of what that does in game compared to default view.
     
    nericksenna likes this.
  4. privatebrian

    privatebrian Registered

    Joined:
    Jan 30, 2012
    Messages:
    598
    Likes Received:
    12
    Very cool...Thankyou very much :)
     
  5. FuNK!

    FuNK! Registered

    Joined:
    May 26, 2013
    Messages:
    626
    Likes Received:
    491
    sounds like the tilt which is available in AC's camera options...if it is this exact option I only can say: RESPECT!
    I ever wanted this exact option!

    Side question: Would it be possible mapping the camera movement in cockpit with the mouse movement!? Just like it is with Race07 etc. This would be awesome too! :D

    EDIT: OK, it is exactly what I hoped it is :D nearly every cockpit camera need a slight tilt downwards and now we're able to set it manually ;)
     
    Last edited by a moderator: Apr 21, 2015
  6. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    I knew someone would ask that! I know I've always preferred zip files rather than 'installers', because you never know what the installer is going to do (especially in rF1, where some would throw files all over the place) but in the past I've found most 'plugin isn't running' reports are from people not putting the files in the right place, especially with rF2's core install folder vs Core folder, Bin32/64, etc etc. I might compromise and add an option to just extract the plugin files, but after it tries to find the rF2 folder and offers to install automatically :)

    I made a mistake in my post (now edited) by mentioning 'camera position' instead of angle. That might have confused things. All it does is let you change the camera angle to basically anything you want (including looking backwards, straight up or down, and even upside down depending how you combine the adjustments...!) and saves it for each different car class, or specific vehicle, that you set. So you can come back to that car later and the plugin will put your view where you set it.

    Having said that, it would probably help to have a couple of images to explain what it does and how to basically use it.

    I did consider that, but I think it may be impossible to read the current position when moving the view around with the mouse (via free look etc), at least from what I can see; it might be possible to assign the mouse (or other input) to the camera tilt inputs and then read what they're doing in a 'set' phase, but that starts to get pretty complicated and I'd like to keep it fairly simple with a single method for doing things. Plus mouse adjustment could get fiddly - the pitmenu controls should be easy to use by everyone, just might take a little while if you're making big adjustments.

    It's worth remembering rF2 now has seat pitch/roll/yaw adjustments in the player.JSON, so if you just need a global adjustment it might be easier to do it there. But adjusting for individual cars would be annoying that way, hence the plugin.
     
    pkelly likes this.
  7. GFraser1965

    GFraser1965 Registered

    Joined:
    Oct 6, 2010
    Messages:
    13
    Likes Received:
    0
    Does this plugin also work for rF1? ............. (our league still runs rF1) .......... any possibility of getting one for rF1?
    Thanks for the hard work.
     
  8. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    This is currently rF2 only unfortunately.

    I haven't looked into whether the same camera tilt/yaw controls can be adjusted live in the same way (I suspect they can) in rF1, the feedback would have to be done differently because you can't display messages, and there'd have to be a defined key to activate the adjustment (set via an .ini file) because it doesn't have a custom plugin control feature. I may take a look at some point.
     
  9. kiko0602

    kiko0602 Registered

    Joined:
    Dec 25, 2011
    Messages:
    255
    Likes Received:
    37
    thx lazza for plugin :) i was using glovepie before 64bit build came out,but it stoped working til then..so thx again
     
  10. Redpxl

    Redpxl Registered

    Joined:
    Jun 12, 2012
    Messages:
    59
    Likes Received:
    21
    Thank you Lazza for this great little tool.

    For some reason after initial use i ended up with 2 entries for your plugin in control menu (duplicating the control key assigned)
    Every click was register as 2 clicks and saving, leaving the plugin. I had to unassigned one to make it work again.

    No idea if this is currently possible, but it would also be nice to have left and right MOVEMENT per class/car (not only rotate).
     
  11. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    That's exactly the same issue I had with 2 separate installs of rF2 (a 910->930 update, and a clean 946). But fresh installs of 906, 910, and 946 all worked fine, so I gave up chasing my tail and released it (erm... the plugin, not my tail...). Still not sure if it's something I'm doing in the plugin or an rF2 bug.

    Doesn't the seat movement already get saved by vehicle in rF2? Technically it is possible to do (if you assign the camera movement controls to your steering wheel or pedals you can see pretty much all cameras can be moved this way) just not sure what practical advantage it would have over the seat movement the game provides. Well, ok, I can see that the seat movement only works in the actual cockpit view, whereas a plugin movement would allow you to offset the bonnet/bumper cam for example... hmm...
     
  12. Redpxl

    Redpxl Registered

    Joined:
    Jun 12, 2012
    Messages:
    59
    Likes Received:
    21
    I guess i need to do a clean install :) thank you

    hmmm, not sure we can move seat left and right atm. We can move view left and right in .json but that is globally apply (like tilt)
     
  13. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    You're right, of course... been obsessed with tilt for a couple of days and forgot what the game actually does lol

    I'd like to try and track down what causes that control 'bug', since a clean install seems ok but some installs do it. Matter of trial and error I guess. The only saving grace is that generally you set a car/class once and then leave it, so even if you have to go and unassign one of the duplicate controls it's not going to cause too much grief, but I did at one point have an extra one added every time I started rF2 which is more of a pain, so finding the root cause would be good.

    *Edit: it appears to be some sort of interaction issue between this plugin and (some) others; if I install my motec plugin and HeadTilt, I get the duplicate control issue. Redpxl has confirmed the same thing but with a list of plugins that doesn't include the motec plugin. Further investigation is required. It looks like the next version will need to do its own activation key setup and checking, which is a shame because the built-in one is convenient.
     
    Last edited by a moderator: Apr 22, 2015
  14. whitmore

    whitmore Registered

    Joined:
    Feb 26, 2012
    Messages:
    552
    Likes Received:
    142
    I now have 3 extra Head tilt controls listed in the devices. None are assigned. How would I remove the extra ones.
     
  15. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    In your controller.JSON. You'll find them right down the bottom.

    I've done quite a bit of testing but haven't found the reason for this; ISI will look into it but that won't happen straight away so I'll try and get to a new version that just uses a 'normal' key detection until it gets sorted.
     
  16. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    I've finally got some time and put together V1.1.

    First, the previous .ini settings will no longer work with this version. Sorry about that, it just wasn't worth trying to read both sets of settings and cleaning up the .ini automatically.

    Changes from V1.0:
    • The HeadTilt custom control has been removed. You now need to press a key to enter/exit the HeadTilt menu. This key is Y by default, but you can change that in the .ini.
    • You can now adjust the:
      1. camera angle (using only the pitmenu movement keys, as before)
      2. X-Z position (by holding Shift)
      3. Y-pos and Roll (by holding Alt)
    • The auto installer requests admin rights when run, so running it shouldn't result in a non-install.
    • For the nervous, the .dll files are included directly in the archive for manual install.
    • Fixed up the switching on and off when using freelook and exiting to the monitor to avoid flying cameras, plus made the Active and AllowHWDisable options work properly.

    If you have used V1.0 please delete/rename the existing .ini file.
     
  17. george4203

    george4203 Registered

    Joined:
    Mar 10, 2014
    Messages:
    7
    Likes Received:
    1
    Thanks for this plugin...sorry this is a silly question. For proper installation of the new version should I delete the ini file and install the new version over top?
     
  18. Corti

    Corti Registered

    Joined:
    Sep 29, 2014
    Messages:
    1,354
    Likes Received:
    2,495
    Lazza, thx for this job.
    ;)
     
  19. albert39

    albert39 Registered

    Joined:
    Jan 30, 2014
    Messages:
    75
    Likes Received:
    12
    Fantastic job, it goes perfect, many thanks!
     
  20. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    That would be best, yeah. The old .ini probably wouldn't break it, you'd just end up with old stuff in there that isn't used anymore.
     

Share This Page