Post

Replies

Boosts

Views

Activity

Reply to How to make an entity move in a RealityView so that collisions can be detected
Thank you! I have a few clarifying questions: When in kinematic mode is the ModelEntity ignored for collision detection? When I add an entity to RealityView's content, via .add() what Anchor does this attach it to? If I have an anchor with multiple ModelEntities attached, they each have to be added to the content to be picked up by the physics engine? But when I do this, they ignore the anchor's translation and default to the world view. And finally, when simulating something like a bullet/arrow, is it better to use a TriggerVolume component for efficiency?
May ’24
Reply to NSFilePresenter update not firing on iPad - does on Mac with identical code.
I have worked out the issue. On iOS one needs to set up an NSMetadataQuery in addition to using a NSFilePresenter. Something like: let metadataQuery = NSMetadataQuery() metadataQuery.notificationBatchingInterval = 1 metadataQuery.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope] metadataQuery.predicate = NSPredicate(format: "%K LIKE %@", NSMetadataItemFSNameKey, "*.txt") metadataQuery.start() And then establish a process to listen for changes. For example using Combine: NotificationCenter.default.publisher(for: .NSMetadataQueryDidUpdate) .receive(on: DispatchQueue.main) .sink { [weak self] notification in guard let self = self else { return } self.metadataQuery.stop() for resultSets in 0..<self.metadataQuery.resultCount { if let resultSet = self.metadataQuery.result(at: resultSets) as? NSMetadataItem { /// DO YOUR MAGIC HERE... } } self.metadataQuery.start() } .store(in: &backgroundProcesses)
Topic: App & System Services SubTopic: General Tags:
Mar ’22
Reply to Running FileManager.default.enumerator on different tasks
OK - my bad! I set-up a separate project, away from my main code base that test running multiple FileManager enumerations in parallel (using Tasks) and it all worked...couldn't provoke it no matter how hard I prodded it. And then my eyes flicked back to my main code and a small dim light bulb in my head went on....four hours later I've tracked down a somewhat subtle bug in my code. thank you for your responses!
Topic: App & System Services SubTopic: General Tags:
Nov ’21
Reply to How to make an entity move in a RealityView so that collisions can be detected
Thank you! I have a few clarifying questions: When in kinematic mode is the ModelEntity ignored for collision detection? When I add an entity to RealityView's content, via .add() what Anchor does this attach it to? If I have an anchor with multiple ModelEntities attached, they each have to be added to the content to be picked up by the physics engine? But when I do this, they ignore the anchor's translation and default to the world view. And finally, when simulating something like a bullet/arrow, is it better to use a TriggerVolume component for efficiency?
Replies
Boosts
Views
Activity
May ’24
Reply to NSFilePresenter update not firing on iPad - does on Mac with identical code.
I have worked out the issue. On iOS one needs to set up an NSMetadataQuery in addition to using a NSFilePresenter. Something like: let metadataQuery = NSMetadataQuery() metadataQuery.notificationBatchingInterval = 1 metadataQuery.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope] metadataQuery.predicate = NSPredicate(format: "%K LIKE %@", NSMetadataItemFSNameKey, "*.txt") metadataQuery.start() And then establish a process to listen for changes. For example using Combine: NotificationCenter.default.publisher(for: .NSMetadataQueryDidUpdate) .receive(on: DispatchQueue.main) .sink { [weak self] notification in guard let self = self else { return } self.metadataQuery.stop() for resultSets in 0..<self.metadataQuery.resultCount { if let resultSet = self.metadataQuery.result(at: resultSets) as? NSMetadataItem { /// DO YOUR MAGIC HERE... } } self.metadataQuery.start() } .store(in: &backgroundProcesses)
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Running FileManager.default.enumerator on different tasks
OK - my bad! I set-up a separate project, away from my main code base that test running multiple FileManager enumerations in parallel (using Tasks) and it all worked...couldn't provoke it no matter how hard I prodded it. And then my eyes flicked back to my main code and a small dim light bulb in my head went on....four hours later I've tracked down a somewhat subtle bug in my code. thank you for your responses!
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’21