public override void UpdateComponent() { if (SteamDevice.status == Status.Unavailable) { status = Status.Unavailable; } if (SteamDevice.GetConfidence(trackerId) == 0) { status = SteamDevice.IsPresent(trackerId) ? Status.Present : Status.Unavailable; positionConfidence = 0; rotationConfidence = 0; gameObject.SetActive(false); return; } status = Status.Tracking; Vector3 localSensorPosition = Target.ToVector3(SteamDevice.GetPosition(trackerId)); Quaternion localSensorRotation = Target.ToQuaternion(SteamDevice.GetRotation(trackerId)); transform.position = trackerTransform.TransformPoint(localSensorPosition); transform.rotation = trackerTransform.rotation * localSensorRotation; positionConfidence = SteamDevice.GetConfidence(trackerId); rotationConfidence = SteamDevice.GetConfidence(trackerId); gameObject.SetActive(true); FuseWithUnityCamera(); }
public override void UpdateComponent() { if (SteamDevice.status == Status.Unavailable) { status = Status.Unavailable; } //if (trackerId < 0) // FindOutermostController(isLeft); if (SteamDevice.GetConfidence(trackerId) == 0) { status = SteamDevice.IsPresent(trackerId) ? Status.Present : Status.Unavailable; positionConfidence = 0; rotationConfidence = 0; gameObject.SetActive(false); return; } status = Status.Tracking; Vector3 localSensorPosition = Target.ToVector3(SteamDevice.GetPosition(trackerId)); Quaternion localSensorRotation = Target.ToQuaternion(SteamDevice.GetRotation(trackerId)); transform.position = trackerTransform.TransformPoint(localSensorPosition); transform.rotation = trackerTransform.rotation * localSensorRotation; positionConfidence = SteamDevice.GetConfidence(trackerId); rotationConfidence = SteamDevice.GetConfidence(trackerId); gameObject.SetActive(true); Passer.VRControllerState_t controllerState = new Passer.VRControllerState_t(); var system = Passer.OpenVR.System; uint controllerStateSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(Passer.VRControllerState_t)); bool newControllerState = system.GetControllerState((uint)trackerId, ref controllerState, controllerStateSize); if (system != null && newControllerState) { UpdateInput(controllerState); } }
public override bool IsPresent() { bool isPresent = SteamDevice.IsPresent(subTrackerId); return(isPresent); }