Second version of the GTA 5 machinima VR tracked camera mod. Supports both Legacy and Enhanced GTA 5. Lots of bugs present. Requires Script Hook V .Net by Chiheb-Bacha Put OpenXrCameraController.3.cs in the scripts folder
Requires an OpenXR compatible VR headset (or SteamVR)
This project contains a ScriptHookVDotNet camera controller plus a control panel that hosts the OpenXR bridge in-process. The current setup is monitor-only: the headset drives the in-game scripted camera, but the project does not submit rendered frames to the HMD yet.
OpenXrCameraController.3.cs- Main ScriptHookVDotNet v3 script.
- Toggles XR camera mode in game.
- Reads live settings from
Local\GTA5OpenXrControland headset pose fromLocal\GTA5OpenXrPose.
OpenXrCameraController.ini- Persistent settings file used by the control panel.
OpenXrControlPanel\- External WinForms control panel.
- Edits
OpenXrCameraController.ini. - Pushes live setting changes and commands into the
Local\GTA5OpenXrControlshared-memory block. - Hosts the OpenXR bridge in-process and publishes headset/controller data into
Local\GTA5OpenXrPose.
F10enables or disables OpenXR camera mode once the control panel has published settings.F11faces the in-game camera north while keeping the current device pitch and roll.PageUpzooms in.PageDownzooms out.Homeresets zoom.- While XR mode is active, left grip nudges
FarDepthOfFielddown and right grip nudges it up.
- Uses headset tracking for camera orientation.
- When tracking first activates, the in-game camera starts at your current real-world rotation instead of inheriting the previous gameplay camera heading.
- Positional tracking follows the active headset/controller forward direction, so moving forward physically moves forward in-game for the current tracking source.
- Supports positional tracking when
EnablePositionTracking=true. - Can track the headset or a simplified
LeftController/RightControllersource. - Uses a scripted render camera instead of the normal gameplay camera.
- Supports manual zoom by adjusting the scripted camera field of view.
- Supports scripted-camera depth of field tuning for cinematic shots.
- Supports camera-position nudging from VR thumbsticks while XR mode is active.
- Can stay active in vehicles when
AutoSuspendOffFoot=false. - Supports anchor targets for vehicles, standing vehicles, and the player character instead of only freezing in world space.
- Accepts live config updates and runtime commands from the external control panel.
- Automatically suspends when the game is paused, a cutscene is active, or the player is not on foot and
AutoSuspendOffFoot=true. - Automatically resumes when conditions are valid again and XR mode is still enabled.
The control panel persists settings in OpenXrCameraController.ini, then publishes them to Local\GTA5OpenXrControl for the script to read.
[Input]
ToggleKey=F10
RecenterKey=F11
ZoomInKey=PageUp
ZoomOutKey=PageDown
ResetZoomKey=Home
[Tracking]
EnablePositionTracking=true
TrackingSource=Headset
TranslationScale=1.0
[Behavior]
AutoSuspendOffFoot=false
HideHud=false
EnablePlayerAnchor=false
EnablePlayerAnchorYaw=false
[Vehicle]
EnableVehicleAnchor=true
EnableStandingVehicleAnchor=false
[Zoom]
ZoomStep=1.0
MinFieldOfView=25.0
MaxFieldOfView=90.0
[Smoothing]
RotationSmoothingSeconds=0.04
PositionSmoothingSeconds=0.06
ZoomSmoothingSeconds=0.08
[DepthOfField]
DepthOfFieldStrength=0.0
NearDepthOfField=0.0
FarDepthOfField=0.0ToggleKeyandRecenterKeyuseSystem.Windows.Forms.Keysnames.RecenterKeyremains the config name for the Face North action for backward compatibility.TranslationScale=1.0keeps headset translation at full scale.- Set
EnablePositionTracking=falseif you only want rotational tracking. TrackingSource=Headsetuses the HMD.LeftControllerandRightControlleruse the selected hand's controller pose.- Set
AutoSuspendOffFoot=falseif you want XR camera mode to keep running while driving or riding in a vehicle. - Set
HideHud=trueif you want the HUD and radar hidden while XR camera mode is enabled. - Set
EnablePlayerAnchor=trueto make the anchor follow the player character's position while on foot. - Set
EnablePlayerAnchorYaw=trueto also rotate the player anchor with the character's facing yaw. This only applies whenEnablePlayerAnchor=true. - Set
EnableVehicleAnchor=trueto make the camera ride with the current vehicle while seated in it, while keeping the anchor orientation stable. - Set
EnableStandingVehicleAnchor=trueto anchor to the vehicle under the player when standing on top of it. - If multiple anchor options are enabled at once, priority is
EnableVehicleAnchor, thenEnableStandingVehicleAnchor, thenEnablePlayerAnchor, then world-space anchoring. Zoom Speedchanges how quickly the right-stick zoom adjusts the field of view.Disable Rollremoves camera bank so you do not get a Dutch angle.MinFieldOfViewandMaxFieldOfViewclamp the zoom range.- The smoothing values are in seconds.
0means instant, and larger values add more easing/lag. RotationSmoothingSeconds,PositionSmoothingSeconds, andZoomSmoothingSecondsare independent, so you can keep rotation snappy while softening movement or zoom.DepthOfFieldStrength=0disables the effect. Increase it and tuneNearDepthOfField/FarDepthOfFieldto shape focus falloff.- The
Far DOFslider in the control panel uses a standard linear0to10range.
When you press F10, the script waits for live OpenXR pose data on Local\GTA5OpenXrPose. That data is provided by OpenXrControlPanel while it is running.
The embedded OpenXR host follows a capability-first initialization flow:
- Resolve the active OpenXR runtime registration and locate
openxr_loader.dll. - Enumerate available API layers and instance extensions.
- Enable required and optional extensions.
- Create the OpenXR instance and log the runtime name/version.
- Resolve the OpenXR system id.
- Enumerate supported view configurations and choose
PrimaryStereofirst, thenPrimaryMono. - Create a headless session.
- Enumerate supported reference spaces and choose
Localas the tracking space. - Create
LocalandViewreference spaces. - Enter the steady-state event and pose loop.
OpenXrControlPanel.OpenXr.log records richer startup diagnostics, including:
- active runtime registration and runtime library
- available API layers
- available extensions
- enabled extensions
- runtime name/version
- system id
- supported and chosen view configuration
- supported and chosen tracking space
- timing fallback availability and usage
ScriptHookV.dllScriptHookVDotNet.asiScriptHookVDotNet3.dll- A working 64-bit OpenXR runtime
This setup has been tested primarily against SteamVR-style runtimes, but it is designed to negotiate capabilities instead of assuming one exact runtime layout.
The project has two compile paths:
OpenXrControlPanelis the WinForms app and embedded OpenXR host, built withdotnet.OpenXrCameraController.3.csis compiled by ScriptHookVDotNet when GTA loads scripts.
Build the control panel from OpenXrControlPanel\:
dotnet buildOr publish it:
dotnet publish -c Release -o publishThe camera script does not need a separate manual compile step. Place these in GTA V's scripts folder:
OpenXrCameraController.3.csOpenXrCameraController.ini
The control panel can run outside GTA. Point it at OpenXrCameraController.ini, then use:
Apply Liveto push current settings into the shared control mapReset Defaultsto restore the built-in factory camera values without reloading from diskSave .inito persist them for future sessionsToggle XR,Face North,Reset Zoom,Start Record,Stop + Save, andStop + Discardfor runtime commandsTracking Sourceto swap between the headset and the left/right controller liveLeft Thumbsticknudges the camera anchor left/right and forward/back, whileRight Thumbstick Ynudges it up/down
Then launch OpenXrControlPanel, launch GTA V, or press Insert to reload scripts and let ScriptHookVDotNet compile the script. The script waits for the control panel to publish settings before it becomes usable.
- If the script does not compile, check
ScriptHookVDotNet.login the GTA V root folder. - If the script loads but tracking does not start, make sure
OpenXrControlPanelis running and that a 64-bit OpenXR runtime is installed and registered. - If the control panel starts but pose data is not available, check
OpenXrControlPanel.OpenXr.log. - If the camera feels wrong, use
F11to face north while keeping your current device pitch and roll, then tuneTranslationScale,Zoom Speed, the smoothing values, or the zoom FOV limits in the.ini. - If you are using the control panel, you can adjust the same values live without restarting scripts.
- If startup fails, the bridge log should now show which stage failed: loader resolution, extension negotiation, system discovery, view-configuration selection, reference-space selection, or timing fallback.
- This is not full VR rendering.
- Headset mirroring and swapchain submission are intentionally not part of the current build.
- It is head-tracked flatscreen camera control.
- Older test files like
RotateCameraOnL.csare separate from this OpenXR setup.