Fix controller orientation for OpenXR and Varjo
This commit is contained in:
		
							parent
							
								
									64af1d26da
								
							
						
					
					
						commit
						285aefc2ae
					
				@ -15,6 +15,7 @@ namespace Passer.Tracking {
 | 
			
		||||
            None,
 | 
			
		||||
            Oculus,
 | 
			
		||||
            OpenXR,
 | 
			
		||||
            Varjo,
 | 
			
		||||
        }
 | 
			
		||||
        protected LoadedDeviceType loadedDevice = LoadedDeviceType.None;
 | 
			
		||||
        public GameObject model;
 | 
			
		||||
@ -141,7 +142,8 @@ namespace Passer.Tracking {
 | 
			
		||||
                loadedDevice = LoadedDeviceType.Oculus;
 | 
			
		||||
            else if (XRSettings.loadedDeviceName == "OpenXR Display")
 | 
			
		||||
                loadedDevice = LoadedDeviceType.OpenXR;
 | 
			
		||||
 | 
			
		||||
            else if (XRSettings.loadedDeviceName == "VarjoDisplay")
 | 
			
		||||
                loadedDevice = LoadedDeviceType.Varjo;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@ -200,8 +202,9 @@ namespace Passer.Tracking {
 | 
			
		||||
 | 
			
		||||
                Quaternion rotation;
 | 
			
		||||
                if (isTracked && device.TryGetFeatureValue(CommonUsages.deviceRotation, out rotation)) {
 | 
			
		||||
                    //if (loadedDevice == LoadedDeviceType.OpenXR)
 | 
			
		||||
                    //    rotation *= Quaternion.AngleAxis(45, Vector3.right);
 | 
			
		||||
                    if (loadedDevice == LoadedDeviceType.OpenXR || 
 | 
			
		||||
                        loadedDevice == LoadedDeviceType.Varjo)
 | 
			
		||||
                        rotation *= Quaternion.AngleAxis(45, Vector3.right);
 | 
			
		||||
                    transform.rotation = trackerTransform.rotation * rotation;
 | 
			
		||||
                    rotationConfidence = 1;
 | 
			
		||||
                    status = Tracker.Status.Tracking;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user