core-motion

CMMotionActivityManager queryActivityStarting data not available outside closure

我们两清 提交于 2021-01-29 05:18:12
问题 I have this code to get historical motion activity from using CoreMotionActivity. func buildActivityArray() -> Array<Any> { let now = Date() let then = Date().addingTimeInterval(-3600) var motionManager: CMMotionActivityManager! motionManager = CMMotionActivityManager() var activityList: [Any] = [] motionManager.queryActivityStarting(from: then, to: now, to: .main) { motionActivities, error in if let error = error { print("error: \(error.localizedDescription)") return } motionActivities?

ARKit – How to put 3D Object on QRCode?

℡╲_俬逩灬. 提交于 2020-12-27 08:36:16
问题 I'm actually trying to put a 3D Object on QRCode with ARKit For that I use a AVCaptureDevice to detect a QRCode and establish the area of the QRCode that gives me a CGRect . Then, I make a hitTest on every point of the CGRect to get the average 3D coordinates like so : positionGiven = SCNVector3(0, 0, 0) for column in Int(qrZone.origin.x)...2*Int(qrZone.origin.x + qrZone.width) { for row in Int(qrZone.origin.y)...2*Int(qrZone.origin.y + qrZone.height) { for result in sceneView.hitTest(CGPoint

Detecting Shake Gesture by CoreMotion

人走茶凉 提交于 2020-12-06 15:56:31
问题 I want to detect device shake using coreMotion framework for iOS 7. Can anyone help me out how to do this ? I wrote code described below in my viewDidAppear CMMotionManager *motionManager = [[CMMotionManager alloc] init]; motionManager.deviceMotionUpdateInterval = 1.0/60.0; __block double myAcceleration; [motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) { myAcceleration = motion.userAcceleration.y; CATransform3D

Detecting Shake Gesture by CoreMotion

北战南征 提交于 2020-12-06 15:56:18
问题 I want to detect device shake using coreMotion framework for iOS 7. Can anyone help me out how to do this ? I wrote code described below in my viewDidAppear CMMotionManager *motionManager = [[CMMotionManager alloc] init]; motionManager.deviceMotionUpdateInterval = 1.0/60.0; __block double myAcceleration; [motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) { myAcceleration = motion.userAcceleration.y; CATransform3D

Detecting Shake Gesture by CoreMotion

自作多情 提交于 2020-12-06 15:55:06
问题 I want to detect device shake using coreMotion framework for iOS 7. Can anyone help me out how to do this ? I wrote code described below in my viewDidAppear CMMotionManager *motionManager = [[CMMotionManager alloc] init]; motionManager.deviceMotionUpdateInterval = 1.0/60.0; __block double myAcceleration; [motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) { myAcceleration = motion.userAcceleration.y; CATransform3D

Is there a way to calculate small distances with CoreMotion?

对着背影说爱祢 提交于 2020-07-23 11:15:42
问题 Is it possible to calculate small distances with CoreMotion? For example a user moves his iOS device up or down, left and right and facing the device in front of him (landscape). 回答1: EDIT Link as promised... https://www.youtube.com/watch?v=C7JQ7Rpwn2k position stuff starts at about 23 minutes in. His summary... The best thing to do is to try and not use position in your app. There is a video that I will find to show you. But short answer... No. The margin for error is too great and the

Is there a way to calculate small distances with CoreMotion?

纵饮孤独 提交于 2020-07-23 11:14:09
问题 Is it possible to calculate small distances with CoreMotion? For example a user moves his iOS device up or down, left and right and facing the device in front of him (landscape). 回答1: EDIT Link as promised... https://www.youtube.com/watch?v=C7JQ7Rpwn2k position stuff starts at about 23 minutes in. His summary... The best thing to do is to try and not use position in your app. There is a video that I will find to show you. But short answer... No. The margin for error is too great and the

Is there a way to calculate small distances with CoreMotion?

送分小仙女□ 提交于 2020-07-23 11:13:50
问题 Is it possible to calculate small distances with CoreMotion? For example a user moves his iOS device up or down, left and right and facing the device in front of him (landscape). 回答1: EDIT Link as promised... https://www.youtube.com/watch?v=C7JQ7Rpwn2k position stuff starts at about 23 minutes in. His summary... The best thing to do is to try and not use position in your app. There is a video that I will find to show you. But short answer... No. The margin for error is too great and the

Is there a way to calculate small distances with CoreMotion?

旧街凉风 提交于 2020-07-23 11:13:17
问题 Is it possible to calculate small distances with CoreMotion? For example a user moves his iOS device up or down, left and right and facing the device in front of him (landscape). 回答1: EDIT Link as promised... https://www.youtube.com/watch?v=C7JQ7Rpwn2k position stuff starts at about 23 minutes in. His summary... The best thing to do is to try and not use position in your app. There is a video that I will find to show you. But short answer... No. The margin for error is too great and the