Morrowind

File information

Last updated

Original upload

Created by

zdo

Uploaded by

zdostr

Virus scan

Safe to use

Tags for this mod

About this mod

Head tracking and head bobbing in Morrowind

Permissions and credits
Head tracking and head bobbing in Morrowind.



---

At this stage, it only works with TrackIR.

Instruction.

Stage 1.
  • put on TrackIR device, start TrackIR software
  • download and install the mod
  • in mod folder, go to "TrackIR_reader"
  • open read.py
  • adjust file_path variable. Script will be writing data from TrackIR to this file. The file will be later read the Morrowind mod.
  • after adjusting file_path, open the console and run "python read.py"
  • now values from TrackIR are being written to the file at "file_path"

Stage 2.
  • in Morrowind, open MCM and put the same file path, so mod will be reading data written by the Python script
  • after that, head tracking should be working automatically
  • you can adjust values in MCM to your liking

---

FAQ.

Q. Why writing to file?
A. Better approach would be to use a shared memory, or something like UDP socket. But it would require more effort, so the first version is doing it via good old text file.

Q. OpenTrack?
A. Definitely is possible. What needs to be added is a way to communicate rotation/translation from OpenTrack to Morrowind mod.
Since I have TrackIR, I do not use OpenTrack, therefore I am not really into working on it.
But feel free to check out the code and add the implementation, it should be straightforward - to write 6 numbers to the text file utilizing existing logic of passing data from TrackIR.

Q. OpenMW?
This mod does not work with OpenMW. Although, I made it working as a proof of concept this way:

  • TrackIR is being read by FreePIE (check out images)
  • FreePIE reports it to vJoy joystick (check out images)
  • OpenMW cannot read vJoy because it is considered by libsdl "not a controller"
  • so, we use x360ce (Xbox 360 controller emulator) - we map each axis from vJoy to axis in x360ce (check out images)
  • in OpenMW, we need to modify "resources\vfs\scripts\omw\camera\head_bobbing.lua" to keep head bobbing working, and add to it the head tracking, similar to this:
    camera.setExtraYaw(input.getAxisValue(input.CONTROLLER_AXIS.RightX) * (3.1415 * 0.8))
    camera.setExtraPitch(input.getAxisValue(input.CONTROLLER_AXIS.RightY) * (3.1415 * 0.45))
    camera.setExtraRoll(camera.getExtraRoll() - input.getAxisValue(input.CONTROLLER_AXIS.LeftX) * (3.1415 * 0.15))
   
    local offset = util.vector3(
        (input.getAxisValue(input.CONTROLLER_AXIS.TriggerLeft) - 0.5) * 2 * 30,
        0,
        (input.getAxisValue(input.CONTROLLER_AXIS.TriggerRight) - 0.5) * 2 * 5
    )
    camera.setFirstPersonOffset(camera.getFirstPersonOffset() + offset)
I am not actively using OpenMW, so somebody else may want to do a proper integration.