From 6bf29564316eb75368496282a04bc1504d8dee2d Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 28 Mar 2023 13:52:23 +0100 Subject: [PATCH] Slight adjustment to muzzle position based on whether scoped/two-handed --- Projects/Android/jni/JKXR/VrInputDefault.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Projects/Android/jni/JKXR/VrInputDefault.cpp b/Projects/Android/jni/JKXR/VrInputDefault.cpp index ce82e35..72df553 100644 --- a/Projects/Android/jni/JKXR/VrInputDefault.cpp +++ b/Projects/Android/jni/JKXR/VrInputDefault.cpp @@ -463,8 +463,10 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, -vr.hmdorientation[YAW], xy); } + //If scope is engaged, lift muzzle slightly so that it aligns with the headset + float muzzleLift = (vr.cgzoommode == 2 || vr.cgzoommode == 4) ? 0.12f : 0.0f; float x = offhandPositionAverage[0] - (vr.hmdposition[0] + xy[0]); - float y = (offhandPositionAverage[1] + 0.12f) - (vr.hmdposition[1]); + float y = (offhandPositionAverage[1] + muzzleLift) - (vr.hmdposition[1]); float z = offhandPositionAverage[2] - (vr.hmdposition[2] + xy[1]); float zxDist = length(x, z);