View Single Post
  #3  
Old 05-04-2011, 08:52 PM
lelek lelek is offline
Registered Member
 
Join Date: May 2008
Posts: 6
Thumbs up The ultimate view control

It's me again and I’ve got a new script!
I know no one really cares, but I think it’s brilliant and just need to share with the World. Anyway, I’ll need to break this up a bit for clarity.

What it does:
1. Press space and your center view will shift to the right to line up with the gun sight. Press space again and you’re back to center view. In my opinion this completely resolves issues with German gun sights some people were complaining about.
2. I’m kind of a lazy guy, so when being chased by an opposing fighter (which is most of the time) it’s a bit of a hassle for me to look behind AND lean to the side in order to see around the back seat. That’s why I’ve made the script do the leaning for me while looking towards the back of the plane. And this is done almost imperceptibly I might add.
3. By pressing the middle mouse button you can switch to FOV mode. In this mode you control smooth FOV adjustments with z-axis movement of Freetrack/TIR devices. Actually z-axis movements move your in game head back and forth AND adjust FOV simultaneously. And you can modify the amount at witch one happens over the other (ratio of head movements over FOV adjustment) to suit your preferences. Press the middle mouse button again to regain control of the mouse and click on switches.

How to set it up:
1. Within Il-2 Cliffs of Dover go to Options – Controls – Camera and set “Hold to Adjust Field of View” to “Mouse Middle” and in Aircraft unbind “Space” which is bound by default to “Fire Guns (Machine Guns)”
2. In Freetrack uncheck all of the “View relative translations” check boxes in Profile – Advanced or if you’re using TIR – switch off TrueView. The script already incorporates view relative translations so leaving these options on would produce unpredictable results.
3. Download and install GlovePIE (don’t know the site. Just Google it, you shouldn’t have trouble finding it – it’s free).
4. Run your head tracking software before launching GlovePIE, copy and paste the following script into GlovePIE and press “Run”. After that launch Cliffs of Dover.

PIE.FrameRate = 120 Hz
If Released(Mouse.MiddleButton) then
If var.a = 1 then
var.a = 0
Else
var.a = 1
Key.End = True
Key.End = False
Endif
Endif

If Pressed(Space) then
If var.b = 1 then
var.b = 0
var.xx = 0
Else
var.b = 1
var.xx = 0.02
Endif
Endif

if var.a = 1 then
Mouse.MiddleButton = True
Mouse.DirectInputY = RealTrackIR.z * 0.6
EndIf

var.k = 0.08
If RealTrackIR.yaw > 90 Then
var.x = (- sin(RealTrackIR.yaw) + 1) * (var.k - var.xx)
ElseIf RealTrackIR.yaw < -90 Then
var.x = (- sin(RealTrackIR.yaw) - 1) * (var.k + var.xx)
Else
var.x = 0
EndIf

FakeTrackIR.x = var.xx + var.x + (RealTrackIR.x * cos(RealTrackIR.yaw) * cos(RealTrackIR.roll) + RealTrackIR.y * (-1 * cos(RealTrackIR.pitch) * sin(RealTrackIR.roll) + sin(RealTrackIR.pitch) * sin(RealTrackIR.yaw) * cos(RealTrackIR.roll)) + RealTrackIR.z * (sin(RealTrackIR.pitch) * sin(RealTrackIR.roll) + cos(RealTrackIR.pitch) * sin(RealTrackIR.yaw) * cos(RealTrackIR.roll)))

FakeTrackIR.y = RealTrackIR.x * cos(RealTrackIR.yaw) * sin(RealTrackIR.roll) + RealTrackIR.y * (cos(RealTrackIR.pitch) * cos(RealTrackIR.roll) + sin(RealTrackIR.pitch) * sin(RealTrackIR.yaw) * sin(RealTrackIR.roll)) + RealTrackIR.z * (-1 * sin(RealTrackIR.pitch) * cos(RealTrackIR.roll) + cos(RealTrackIR.pitch) * sin(RealTrackIR.yaw) * sin(RealTrackIR.roll))

FakeTrackIR.z = RealTrackIR.x * (-1 * sin(RealTrackIR.yaw)) + RealTrackIR.y * sin(RealTrackIR.pitch) * cos(RealTrackIR.yaw) + RealTrackIR.z * cos(RealTrackIR.pitch) * cos(RealTrackIR.yaw)

FakeTrackIR.pitch = RealTrackIR.pitch
FakeTrackIR.yaw = RealTrackIR.yaw
FakeTrackIR.roll = RealTrackIR.roll

5. There is one other thing to look out for if you want GlovePIE to emulate TIR properly. After running the script for the first time type regedit and look for the key: HKEY_CURRENT_USER\Software\NaturalPoint\NATURALPOI NT\NPClient Location. There should be two path values inside: one is the GlovePie “Path” which tells games where to find NPClient.dll library and the other is labeled “RealPath” which tells GlovePIE where the real NPClient.dll is so it can emulate it. Anyway. If you don’t find this, or if you only have the “Path” value (GlovePIE should create this automatically the first time you run a “FakeTrackIR” script but this didn’t happen for me, hence this explanation) create a FakeTrackIR.reg file with notepad, write the following into it and run it:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\NaturalPoint\NATURALPOI NT\NPClient Location]
"Path" = "C:\\Insert\\GlovePIE\\NPClient\\Directory\\He re"
"RealPath" = "C:\\Insert\\FreeTrack\\or\\TrackIR\\NPClient\\Dir ectory\\Here"

How to adjust parameters to your liking:
1. var.xx = 0.02 is by how much you want to move to the right to line up the gun sight (negative values move left). The value 0.02 works for the Bf 109 so you might have to change this for other planes.
2. var.k = 0.08 is by how much you want to move to each side while looking back towards the tail of the plane. Feel free to experiment with it to see what works best for you (setting var.k = 0 turns this feature off).
3. The line “Mouse.DirectInputY = RealTrackIR.z * 0.6” has a factor of 0.6 which is really the ratio between in-game z-axis head movement and FOV adjustment sensitivity. This factor is used in combination with your z-axis sensitivity settings within Freetrack or TIR software and is most prone to experimentation. I use Freetrack and my z-axis sensitivity is at 0.3 with tons of smoothing (200 local and 150 global) and a large soft-zone curve, so if you find the FOV changes are too violent for you try reducing this number and vice versa.
4. If you don’t like view relative translations a.k.a. ”TrueView” type behavior just delete the lines which start with FakeTrackIR.x, FakeTrackIR.y and FakeTrackIR.z with a lot of sin-cos stuff and instead put in:

FakeTrackIR.x = var.xx + var.x + RealTrackIR.x
FakeTrackIR.y = RealTrackIR.y
FakeTrackIR.z = RealTrackIR.z

That’s it. Simple really. Try it out and tell me what you think.
Reply With Quote