An unofficial head tracking mod for Valheim that moves the camera with your head while your mouse or controller keeps aiming, driven by a webcam, phone, or any OpenTrack compatible tracker, with no VR headset required.
- Decoupled look and aim - head tracking moves the camera; aim stays on your mouse.
- 6DOF positional tracking - lean, peek, and duck with head position in addition to yaw / pitch / roll.
- Works with any OpenTrack compatible tracker - free options available for PC, iOS and Android
- Valheim (Steam)
- OpenTrack or a compatible head tracking app (smartphone, webcam, or dedicated hardware)
- Windows 10/11 (64-bit)
Download Lopari, choose Valheim, and click Play with head tracking.
- Download the latest installer ZIP from the Releases page.
- Extract the ZIP anywhere.
- Double-click
install.cmd. - Configure OpenTrack to output UDP to
127.0.0.1:4242. - Launch the game.
The installer finds your game via Steam registry lookup and installs BepInEx if it is not already present. If it can't find the game:
- Set the
VALHEIM_PATHenvironment variable to your game folder, or - Run from a command prompt:
install.cmd "D:\Games\Valheim"
If you prefer to place files by hand, or the installer can't locate your game:
- Install BepInEx 5.x (
BepInEx_win_x64ZIP) by extracting it into your Valheim folder. - Run Valheim once to let BepInEx initialize, then close it.
- Grab the
-nexus.zipvariant from the Releases page and extract it into your Valheim folder. The DLLs land atBepInEx\plugins\ValheimHeadTracking\:ValheimHeadTracking.dllCameraUnlock.Core.dllCameraUnlock.Core.Unity.dllCameraUnlock.Core.Unity.BepInEx.dll
The mod listens for OpenTrack pose data on UDP port 4242, on every network
interface. One datagram is six little-endian 64-bit floats in the order
x, y, z, yaw, pitch, roll: position in centimetres, rotation in degrees, 48
bytes in total. Anything that sends that to that port drives the view.
OpenTrack's UDP over network output sends exactly this, and the steps below
set it up.
- Install OpenTrack.
- Pick a tracker under Input, using the notes below.
- Set Output to UDP over network, host
127.0.0.1, port4242. - Press Start. Tracking and the game can start in either order.
OpenTrack ships a neuralnet tracker input that reads a plain webcam. Select it
under Input, pick your camera in its settings, and use the output settings
above. How well it tracks depends on your camera and your lighting, so try it
before buying anything.
A phone app can reach the mod directly, with no OpenTrack on the PC, if it sends
the datagram described above. Point it at this PC's IP address (run ipconfig
to find it) on port 4242. Not every phone tracker speaks this protocol, so
check yours for an OpenTrack or UDP output option first. Headcam
sends it, and I wrote it so decent tracking is free for anyone who already owns
a phone.
Sending direct works when the app filters its own signal on the device. The
mod's smoothing is sized to take the edge off a clean signal rather than to
rescue a noisy one, so a raw feed sent direct will jitter. If it does, point the
app at OpenTrack's UDP over network input on some other port, say 5252,
and let OpenTrack's filters and curves clean it up before its output forwards to
127.0.0.1:4242.
Anything arriving from outside 127.0.0.0/8 counts as a remote connection and
is smoothed with RemoteSmoothing rather than LocalSmoothing. That includes a
tracker on this very PC that sends to the machine's own LAN address, because the
mod reads the source address and not the machine.
If your device has an OpenTrack input driver, select it under Input and use the same output settings. OpenTrack's own Input list is the authority on what it can read; the mod only ever sees what OpenTrack sends.
Centring belongs to your tracker. The mod subtracts no centre of its own: it applies the pose it receives exactly as it arrives, so a stream of zeros holds the view where the game itself puts it. Press the centre control in your tracker (OpenTrack's Center bind, or the CENTER button in Headcam) and the tracker zeroes its own output, which leaves the view centred with the mod doing nothing.
That is why there is no centre hotkey here and nothing to re-centre in game. Two centres in series would drift apart, because each side re-centres at moments the other cannot see, and you would end up pressing twice to centre once. If the view sits off to one side, centre it in the tracker.
Two equivalent binding sets - use whichever your keyboard has. The chord letters sit in the middle of the keyboard so they work on laptops without a nav cluster. These are the default keys: ToggleKey, CycleTrackingModeKey and YawModeKey in CameraUnlock.ini list the keys for each action, chords included (see Configuration).
The tracking-mode cycle steps through 6DOF (rotation + position) -> 3DOF rotation only -> 3DOF position only -> 6DOF. Use the master toggle (End / Ctrl+Shift+Y) to turn tracking off entirely.
| Action | Nav-cluster | Chord |
|---|---|---|
| Toggle head tracking | End |
Ctrl+Shift+Y |
| Cycle tracking mode | Page Up |
Ctrl+Shift+G |
| Toggle yaw mode | Page Down |
Ctrl+Shift+H |
The tracking mode and the yaw mode you pick are saved to CameraUnlock.ini, so the next start begins with them. The master toggle changes the current session only: each start has head tracking on or off as EnableOnStartup says.
The game's crosshair, and the name of whatever you are looking at, move to where your aim points while head tracking turns the view. There is no setting that turns this off.
The mod reads its settings from BepInEx\config\CameraUnlock.ini in the game folder, and creates the file when it starts and finds none. Edit it with any text editor.
A setting set to default takes its value from Defaults.ini, which every head tracking mod that keeps its settings in CameraUnlock.ini reads. Head tracking mods that keep their settings in another file do not read it. Writing a value in place of default changes that setting for this game only. When the mod saves a setting that a hotkey changed in game, it writes the new value in place of default, so that setting no longer follows Defaults.ini in this game until you set it to default again.
Defaults.ini is %AppData%\CameraUnlock\Defaults.ini on Windows; $XDG_CONFIG_HOME/CameraUnlock/Defaults.ini on Linux, or ~/.config/CameraUnlock/Defaults.ini where XDG_CONFIG_HOME is not set, under Wine and Proton too; and ~/Library/Application Support/CameraUnlock/Defaults.ini on macOS. The mod's log, where it writes one, names the file it read.
When the mod starts and finds no Defaults.ini, it creates one holding the built-in values, unless Windows runs the game as a packaged app, or the game runs on Linux or macOS without Wine or Proton. The mod never changes Defaults.ini after that. Edit it with any text editor.
On Linux and macOS without Wine or Proton, this version reads its settings and saves none: it creates no CameraUnlock.ini and a change made in game lasts until the game closes.
BepInEx's ConfigurationManager does not list these settings.
The built-in value of each setting set to default below:
UdpPort=4242EnableOnStartup=trueWorldSpaceYaw=trueRotationEnabled=trueLocalSmoothing=0.0RemoteSmoothing=0.15PositionEnabled=truePositionLimitY=0.2PositionLimitYDown=0.2ToggleKey=End, Ctrl+Shift+YCycleTrackingModeKey=PageUp, Ctrl+Shift+GYawModeKey=PageDown, Ctrl+Shift+H
With every setting at its default, the file reads:
; Valheim head tracking settings.
; Comments start with ; and go on their own line. Text after a value is part of the value.
; Hotkeys are key names such as End, PageUp or Ctrl+Shift+Y. Separate several with commas; leave empty for none.
; A setting set to default takes its value from Defaults.ini, which every head tracking mod
; that keeps its settings in CameraUnlock.ini reads: %AppData%\CameraUnlock\Defaults.ini on
; Windows, $XDG_CONFIG_HOME/CameraUnlock/Defaults.ini (normally ~/.config/CameraUnlock) on
; Linux, under Wine and Proton too, and ~/Library/Application Support/CameraUnlock/Defaults.ini
; on macOS. The log names the file it read. Write a value instead of default to change that
; setting for this game only.
[CameraUnlock]
; Written by the mod. Leave this section in place.
ConfigFormat=1
[Network]
; UDP port the mod receives tracker data on (OpenTrack protocol).
UdpPort=default
[General]
; true: head tracking is on when the game starts. ToggleKey turns it on and off.
EnableOnStartup=default
; true: yaw turns around the world's up axis. false: around the camera's own up axis.
WorldSpaceYaw=default
; true: turning your head turns the view.
; Tracking mode at startup, with PositionEnabled. The mode hotkey changes both.
RotationEnabled=default
[Smoothing]
; Smoothing when the tracker runs on this PC. 0 is the least, 1 the most.
LocalSmoothing=default
; Smoothing when the tracker is another device on the network, such as a phone.
; 0 is the least, 1 the most.
RemoteSmoothing=default
[Position]
; true: moving your head moves the view.
; Tracking mode at startup, with RotationEnabled. The mode hotkey changes both.
PositionEnabled=default
; How far, in metres, raising your head can move the view.
PositionLimitY=default
; How far, in metres, lowering your head can move the view.
PositionLimitYDown=default
[Hotkeys]
; Turns head tracking on and off.
ToggleKey=default
; Changes the tracking mode: rotation and position, rotation only, position only.
CycleTrackingModeKey=default
; Switches yaw between the world's up axis and the camera's own (WorldSpaceYaw).
YawModeKey=defaultSmoothing covers both rotation and position. Which of the two values applies is
decided per connection from the packet source address: a tracker running on this
PC uses LocalSmoothing, a phone or other network device uses RemoteSmoothing.
The mod reads CameraUnlock.ini when the game starts, so restart the game after
editing it.
Mod not loading:
- Verify BepInEx is installed (look for
BepInEx\LogOutput.logafter running the game once). - Ensure all four DLLs are in
BepInEx\plugins\ValheimHeadTracking\. - Check
BepInEx\LogOutput.logfor error messages.
No tracking response:
- Confirm OpenTrack (or your phone app) is running and actively sending data.
- Verify UDP output is set to
127.0.0.1:4242(or your PC's LAN IP if tracking from a phone). - Press End to make sure tracking is enabled.
- Check your firewall isn't blocking UDP port 4242.
View sits off-centre:
- Centre it in your tracker app: OpenTrack's Center bind, or the CENTER button in a phone tracker app. The mod keeps no centre of its own, it applies the pose the tracker sends.
A config edit had no effect:
- Restart the game: the mod reads
CameraUnlock.iniwhen the game starts. - Make sure nothing follows the value on the line: text after a value is part of the value.
BepInEx\LogOutput.lognames each line the mod could not read and the value it used instead.
Jittery / unstable tracking:
- Raise
RemoteSmoothing(phone/network tracker) orLocalSmoothing(tracker on this PC) inCameraUnlock.initoward0.3-0.5, with nothing after the value on the line. - Increase filtering in OpenTrack (Accela filter recommended).
- Improve lighting for webcam-based tracking.
- On WiFi phone tracking, some jitter is expected - the mod's built-in smoothing helps but cannot fully compensate for heavy packet loss.
Wrong rotation axis:
- Invert that axis in OpenTrack's output mapping. This mod has no invert or sensitivity settings; the axis corrections it needs are applied internally and are not configurable.
Yaw feels wrong when looking up or down at extreme angles:
- Try toggling between world-locked and camera-local yaw with
Page Down(orCtrl+Shift+H). World-locked (default) is horizon-stable; camera-local follows the camera's current up-axis.
Download the new release and run install.cmd again. Your CameraUnlock.ini is kept.
Run uninstall.cmd from the release folder. This removes the mod DLLs and leaves BepInEx\config\CameraUnlock.ini in place. The mod loader (BepInEx) is only removed if the installer put it there. To force-remove BepInEx:
uninstall.cmd /force
git clone --recurse-submodules https://github.com/itsloopyo/valheim-headtracking.git
cd valheim-headtracking
# Build and install to game
pixi run install
# Build only
pixi run build
# Package for release
pixi run package- Discord: Loop's Head Tracking Hangout - setup help, bug reports, and new-release announcements
- Lopari - free Windows launcher with one-click install and launch for the released head-tracking mods
- Headcam - free app that turns your iPhone or Android phone into the head tracker
MIT License - see LICENSE for details.
- Iron Gate AB - Valheim
- BepInEx - Unity modding framework
- Harmony - Runtime patching library
- OpenTrack - Head tracking software
This mod is not affiliated with, endorsed by, or supported by Iron Gate AB. It modifies only what the local client renders and does not change aim, hit detection, or any game logic - server-authoritative behavior is untouched. Use at your own risk, and be considerate of other players when running it in multiplayer sessions.