Post

Replies

Boosts

Views

Activity

watch os 9 sleep analysis is not accurate as health app
let stagePredicate = HKCategoryValueSleepAnalysis.predicateForSamples(.equalTo,value: .asleepREM)         let queryPredicate = HKSamplePredicate.sample(type: HKCategoryType(.sleepAnalysis), predicate: stagePredicate)         let sleepQuery = HKSampleQueryDescriptor(predicates: [queryPredicate], sortDescriptors: [])         do{             let sleepSample = try await sleepQuery.result(for: store)                          print("sleep sample ")             print(sleepSample) with health app on iOS , it says I did rem sleep for 59 minutes. but all sum of sleep sample time is not 59 but 3.7hours. time is also not accurate. sleepSample log is as below what may be the problem?
1
0
1.2k
Jun ’22
RealityKit - How can I calculate distance between two anchorEntity?
there's position which is simd3 and there 's anchorEntity. I want to get distance between two. how I did is var distance = distance(position, ( self.modelentity.position(relativeTo:nil) ) var distance = distance(position, ( self.modelentity.position ) but both failed because it seems calculating distance between world origin anchor not distance between position to self.modelentity. how can I calculate distance ?
2
1
1.8k
Feb ’22