3
개체를 둘러 볼 수있는 것처럼 보이게하는 응용 프로그램을 디자인하려고합니다. 나는 꽤 멀리 보았지만, 그림 프레임과 같이 공중에서 물체를 떠있는 것처럼 보이게 만드는 방법을 알아낼 수는 없다.Core Motion 및 CATransform3D를 사용하여 이미지 회전
CMMotionManager *motionManager = [[CMMotionManager alloc] init];
[motionManager setDeviceMotionUpdateInterval:0.1];
CMDeviceMotionHandler motionHandler =^(CMDeviceMotion *motion, NSError *error)
{
[xLabel setText:[NSString stringWithFormat:@"X: %f, Yaw: %f", motion.userAcceleration.x, motion.attitude.yaw]];
[yLabel setText:[NSString stringWithFormat:@"Y: %f, Pitch: %f", motion.userAcceleration.y, motion.attitude.pitch]];
[zLabel setText:[NSString stringWithFormat:@"Z: %f, Roll: %f", motion.userAcceleration.z, motion.attitude.roll]];
CATransform3D transform;
transform = CATransform3DMakeRotation(motion.attitude.pitch, 1, 0, 0);
transform = CATransform3DRotate(transform, motion.attitude.roll, 0, 1, 0);
transform = CATransform3DRotate(transform, motion.attitude.yaw, 0, 0, 1);
myView.layer.sublayerTransform = transform;
//[myImage setNeedsDisplay];
};
[motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXTrueNorthZVertical toQueue:[NSOperationQueue currentQueue] withHandler:motionHandler];
이 사진이 책상에 평면처럼 보이게하지만,이 벽에 끊었 것처럼 대신 표시되어야합니다
여기 내 코드입니다. 어떻게하는지에 대한 아이디어가 있습니까?