Fix UnityXR Haptics
This commit is contained in:
		
							parent
							
								
									6d3c7edd0d
								
							
						
					
					
						commit
						aa61ffd2f4
					
				| @ -247,6 +247,14 @@ namespace Passer.Tracking { | |||||||
|                 renderers[i].enabled = showModel; |                 renderers[i].enabled = showModel; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         public virtual void Vibrate(float length, float strength) { | ||||||
|  |             if (device.TryGetHapticCapabilities(out var capabilities) && | ||||||
|  |                 capabilities.supportsImpulse) { | ||||||
|  | 
 | ||||||
|  |                 device.SendHapticImpulse(0u, strength, length); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         #endregion Init |         #endregion Init | ||||||
| #endif | #endif | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -139,6 +139,12 @@ namespace Passer.Humanoid { | |||||||
|             controllerInputSide.option |= controller.option > 0; |             controllerInputSide.option |= controller.option > 0; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         public override void Vibrate(float length, float strength) { | ||||||
|  |             UnityXRController unityXrController = sensorComponent as UnityXRController; | ||||||
|  |             if (unityXrController != null) | ||||||
|  |                 unityXrController.Vibrate(length, strength); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         // arm model for 3DOF tracking: position is calculated from rotation |         // arm model for 3DOF tracking: position is calculated from rotation | ||||||
|         static public Vector3 CalculateHandPosition(HandTarget handTarget, Vector3 sensor2TargetPosition) { |         static public Vector3 CalculateHandPosition(HandTarget handTarget, Vector3 sensor2TargetPosition) { | ||||||
|             Quaternion hipsYRotation = Quaternion.AngleAxis(handTarget.humanoid.hipsTarget.transform.eulerAngles.y, handTarget.humanoid.up); |             Quaternion hipsYRotation = Quaternion.AngleAxis(handTarget.humanoid.hipsTarget.transform.eulerAngles.y, handTarget.humanoid.up); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user