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 {
|
||||
#if pUNITYXR
|
||||
//public TrackerComponent tracker;
|
||||
//public Transform sensorTransform {
|
||||
// get { return this.transform; }
|
||||
//}
|
||||
|
||||
protected InputDevice device;
|
||||
|
||||
protected XRNode xrNode;
|
||||
@ -182,19 +177,22 @@ namespace Passer.Tracking {
|
||||
|
||||
status = Tracker.Status.Present;
|
||||
|
||||
bool isTracked = false;
|
||||
if (device.TryGetFeatureValue(CommonUsages.isTracked, out isTracked)) {
|
||||
Vector3 position;
|
||||
if (device.TryGetFeatureValue(CommonUsages.devicePosition, out position)) {
|
||||
if (isTracked && device.TryGetFeatureValue(CommonUsages.devicePosition, out position)) {
|
||||
transform.position = trackerTransform.TransformPoint(position);
|
||||
positionConfidence = 1;
|
||||
status = Tracker.Status.Tracking;
|
||||
}
|
||||
|
||||
Quaternion rotation;
|
||||
if (device.TryGetFeatureValue(CommonUsages.deviceRotation, out rotation)) {
|
||||
if (isTracked && device.TryGetFeatureValue(CommonUsages.deviceRotation, out rotation)) {
|
||||
transform.rotation = trackerTransform.rotation * rotation;
|
||||
rotationConfidence = 1;
|
||||
status = Tracker.Status.Tracking;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateInput();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user