public override void UpdateComponent() { status = Status.Tracking; if (OculusDevice.status == Status.Unavailable) { status = Status.Unavailable; } Sensor.ID sensorID = isLeft ? Sensor.ID.LeftHand : Sensor.ID.RightHand; if (OculusDevice.GetRotationalConfidence(sensorID) == 0) { status = Status.Present; } if (status == Status.Present || status == Status.Unavailable) { positionConfidence = 0; rotationConfidence = 0; gameObject.SetActive(false); return; } Vector3 localSensorPosition = Target.ToVector3(OculusDevice.GetPosition(sensorID)); Quaternion localSensorRotation = Target.ToQuaternion(OculusDevice.GetRotation(sensorID)); transform.position = trackerTransform.TransformPoint(localSensorPosition); transform.rotation = trackerTransform.rotation * localSensorRotation; positionConfidence = OculusDevice.GetPositionalConfidence(sensorID); rotationConfidence = OculusDevice.GetRotationalConfidence(sensorID); gameObject.SetActive(true); UpdateInput(sensorID); }
public override void UpdateComponent() { if (OculusDevice.GetRotationalConfidence(sensorId) == 0) { status = OculusDevice.IsPresent(0) ? Status.Present : Status.Unavailable; positionConfidence = 0; rotationConfidence = 0; gameObject.SetActive(false); return; } status = Status.Tracking; Vector3 localPosition = Target.ToVector3(OculusDevice.GetPosition(sensorId)); Quaternion localRotation = Target.ToQuaternion(OculusDevice.GetRotation(sensorId)); transform.position = trackerTransform.TransformPoint(localPosition); transform.rotation = trackerTransform.rotation * localRotation; positionConfidence = OculusDevice.GetPositionalConfidence(sensorId); rotationConfidence = OculusDevice.GetRotationalConfidence(sensorId); gameObject.SetActive(true); FuseWithUnityCamera(); }
public override void UpdateTracker(bool showRealObjects) { #if hOCULUS gameObject.SetActive(showRealObjects && IsPresent()); Vector3 localPosition = Target.ToVector3(OculusDevice.GetPosition(Sensor.ID.Tracker1 + subTrackerId)); Quaternion localRotation = Target.ToQuaternion(OculusDevice.GetRotation(Sensor.ID.Tracker1 + subTrackerId)); transform.position = tracker.trackerTransform.TransformPoint(localPosition); transform.rotation = tracker.trackerTransform.rotation * localRotation; #endif }