@@ -68,16 +68,19 @@ private void OnEnable()
68
68
{
69
69
if ( _settings != null )
70
70
{
71
+ _settings . cameraNearClipPlane . changed -= OnCameraNearClipPlaneChanged ;
71
72
_settings . cameraNearClipPlane . changed += OnCameraNearClipPlaneChanged ;
72
73
}
73
74
74
75
if ( _fpfcSettings != null )
75
76
{
77
+ _fpfcSettings . Changed -= OnFpfcSettingsChanged ;
76
78
_fpfcSettings . Changed += OnFpfcSettingsChanged ;
77
79
}
78
80
79
81
if ( _beatSaberUtilities != null )
80
82
{
83
+ _beatSaberUtilities . focusChanged -= OnFocusChanged ;
81
84
_beatSaberUtilities . focusChanged += OnFocusChanged ;
82
85
OnFocusChanged ( _beatSaberUtilities . hasFocus ) ;
83
86
}
@@ -153,10 +156,13 @@ private void OnFpfcSettingsChanged(IFPFCSettings fpfcSettings)
153
156
154
157
private void OnFocusChanged ( bool hasFocus )
155
158
{
156
- _trackedPoseDriver . UseRelativeTransform = ! hasFocus ;
157
- _trackedPoseDriver . originPose = hasFocus ? Pose . identity : new Pose (
158
- Vector3 . Project ( Quaternion . Euler ( 0 , 180 , 0 ) * - transform . localPosition * 2 , Vector3 . right ) + new Vector3 ( 0 , 0 , 1.5f ) ,
159
- Quaternion . Euler ( 0 , 180 , 0 ) ) ;
159
+ if ( _trackedPoseDriver != null )
160
+ {
161
+ _trackedPoseDriver . UseRelativeTransform = ! hasFocus ;
162
+ _trackedPoseDriver . originPose = hasFocus ? Pose . identity : new Pose (
163
+ Vector3 . Project ( Quaternion . Euler ( 0 , 180 , 0 ) * - transform . localPosition * 2 , Vector3 . right ) + new Vector3 ( 0 , 0 , 1.5f ) ,
164
+ Quaternion . Euler ( 0 , 180 , 0 ) ) ;
165
+ }
160
166
161
167
UpdateCameraMask ( ) ;
162
168
}
0 commit comments