Fix tracking status for UnityXR Controllers
This commit is contained in:
parent
e991920a18
commit
6d3c7edd0d
@ -7,11 +7,6 @@ namespace Passer.Tracking {
|
|||||||
|
|
||||||
public class UnityXRController : ControllerComponent {
|
public class UnityXRController : ControllerComponent {
|
||||||
#if pUNITYXR
|
#if pUNITYXR
|
||||||
//public TrackerComponent tracker;
|
|
||||||
//public Transform sensorTransform {
|
|
||||||
// get { return this.transform; }
|
|
||||||
//}
|
|
||||||
|
|
||||||
protected InputDevice device;
|
protected InputDevice device;
|
||||||
|
|
||||||
protected XRNode xrNode;
|
protected XRNode xrNode;
|
||||||
@ -182,18 +177,21 @@ namespace Passer.Tracking {
|
|||||||
|
|
||||||
status = Tracker.Status.Present;
|
status = Tracker.Status.Present;
|
||||||
|
|
||||||
Vector3 position;
|
bool isTracked = false;
|
||||||
if (device.TryGetFeatureValue(CommonUsages.devicePosition, out position)) {
|
if (device.TryGetFeatureValue(CommonUsages.isTracked, out isTracked)) {
|
||||||
transform.position = trackerTransform.TransformPoint(position);
|
Vector3 position;
|
||||||
positionConfidence = 1;
|
if (isTracked && device.TryGetFeatureValue(CommonUsages.devicePosition, out position)) {
|
||||||
status = Tracker.Status.Tracking;
|
transform.position = trackerTransform.TransformPoint(position);
|
||||||
}
|
positionConfidence = 1;
|
||||||
|
status = Tracker.Status.Tracking;
|
||||||
|
}
|
||||||
|
|
||||||
Quaternion rotation;
|
Quaternion rotation;
|
||||||
if (device.TryGetFeatureValue(CommonUsages.deviceRotation, out rotation)) {
|
if (isTracked && device.TryGetFeatureValue(CommonUsages.deviceRotation, out rotation)) {
|
||||||
transform.rotation = trackerTransform.rotation * rotation;
|
transform.rotation = trackerTransform.rotation * rotation;
|
||||||
rotationConfidence = 1;
|
rotationConfidence = 1;
|
||||||
status = Tracker.Status.Tracking;
|
status = Tracker.Status.Tracking;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateInput();
|
UpdateInput();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user