private void ExecuteUpdatePose(HandData handData, HandReflection handReflection) { var currentState = handData.HandState; var isTracked = (currentState.Status & OVRPlugin.HandStatus.HandTracked) == OVRPlugin.HandStatus.HandTracked; handReflection.SetIsTracked(isTracked); if (isTracked) { handReflection.SetHandConfidence(Hand.OVRPluginConfidenceToHand(currentState.HandConfidence)); } else { handReflection.SetHandConfidence(Hand.HandTrackingConfidence.None); } //WARN: there is some issue with hand flickering most likely due to some timing issue when setting AlphaValue [being overriden by default process] //HACK: for now it may be easiest to always return 1f from 'ScaledAlpha' getter in 'Hand' class // Fade hand according to confidence. var scaledAlphaToApply = handReflection.HandConfidenceFader.NextAlphaValue(handReflection.Hand.HandConfidence); _setScaledAlphaInLateUpdate = () => //That update needs to happen in LateUpdate, otherwise it could be overriden by default process { handReflection.Hand.ScaledAlpha = scaledAlphaToApply; if (handReflection.Hand.HandMesh) { handReflection.Hand.HandMesh.UpdatePose(); } }; // Update Pointer var pointer = handReflection.GetPointer(); pointer.PointerPosition = currentState.PointerPose.Position.FromFlippedZVector3f(); pointer.PointerOrientation = currentState.PointerPose.Orientation.FromFlippedZQuatf(); pointer.PointerStatusValid = (currentState.Status & OVRPlugin.HandStatus.InputStateValid) == OVRPlugin.HandStatus.InputStateValid; if (handReflection.Hand.Skeleton) { handReflection.Hand.Skeleton.UpdatePose(currentState); } if (handData.Step == OVRPlugin.Step.Physics && handReflection.Hand.Physics) { handReflection.Hand.Physics.UpdatePose(); } }
public void Start() { _leftHandReflection = new HandReflection(Hands.LeftHand); _rightHandReflection = new HandReflection(Hands.RightHand); }