我正试图从CMMotion的态度中获得音调,并使用CATransform3D使AVCaptureVideoPreviewLayer变换为俯仰角。像这样:
CATransform3D transform = CATransform3DIdentity;
float zDistance = 850;
transform.m34 = 1.0 / -zDistance;
transform = CATransform3DRotate(transform, -_pitch, 1.0f, 0.0f, 0.0f);
transform = CATransform3DScale(transform, 0.5, 0.5, 0.0);
[_videoPreviewLayer setTransform:transform];
但是,转换后的AVCaptureVideoPreviewLayer非常慢,转换大约需要10秒钟。是否有任何改进预览图层的建议,3D转换更加流畅?
非常感谢!