コード例 #1
0
        private bool TryGetTrackerPose(DeviceUse use, Pose previousPose, Pose correction, Settings.TrackedPointSmoothing smoothing, out Pose pose)
        {
            if (!_shouldTrackFullBody || !_deviceManager.TryGetDeviceState(use, out TrackedDevice device) || !device.isTracking)
            {
                pose = Pose.identity;
                return(false);
            }

            Vector3    position = device.position + device.rotation * correction.position; // correction is forward-facing by definition
            Quaternion rotation = device.rotation * correction.rotation;

            _trackingHelper.ApplyRoomAdjust(ref position, ref rotation);
            _trackingHelper.ApplyTrackerFloorOffset(_avatarManager.currentlySpawnedAvatar, ref position);

            pose = new Pose(Vector3.Lerp(previousPose.position, position, smoothing.position), Quaternion.Slerp(previousPose.rotation, rotation, smoothing.rotation));

            return(true);
        }
コード例 #2
0
        private bool TryGetTrackerPose(TrackedDeviceState device, Pose previousPose, Pose correction, Settings.TrackedPointSmoothing smoothing, out Pose pose)
        {
            if (!_shouldTrackFullBody || !TryGetPose(device, out Pose currentPose))
            {
                pose = Pose.identity;
                return(false);
            }

            Quaternion correctedRotation = currentPose.rotation * correction.rotation;
            Vector3    correctedPosition = currentPose.position + correctedRotation * correction.position; // correction is forward-facing by definition

            pose = new Pose(Vector3.Lerp(previousPose.position, correctedPosition, smoothing.position), Quaternion.Slerp(previousPose.rotation, correctedRotation, smoothing.rotation));
            return(true);
        }