When using ARView of RealityKit, I can code like this let results = arView.raycast(from: point, allowing: .estimatedPlane, alignment: .any) to get the 3D position of where I tap on the plane. In iOS 18, we can use RealityView and I found that unproject(_:from:to:ontoPlane:) may implement the same function, but I don't know how to set the ontoPlane parameter.
Can someone help me with some code snippets?
Post
Replies
Boosts
Views
Activity
Here is a code snippet about AVPlayer.
avPlayer.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: 60), queue: .main) { [weak self] _ in
// Call main actor-isolated instance methods
}
Xcode shows warnings that Call to main actor-isolated instance method '***' in a synchronous nonisolated context; this is an error in the Swift 6 language mode. How can I fix this?
avPlayer.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: 60), queue: .main) { [weak self] _ in
Task { @MainActor in
// Call main actor-isolated instance methods
}
}
Can I use this solution above? But it seems switching actors frequently can slow down performance.
I like the roundedBorder style, but I want to make it more round like a capsule. How to do this?
If I got a file or a file URL, how to judge it is a spatial photo, a panorama photo or a spatial video? Apple's Photo app can do it.
I want to create a ModelEntity that can glow like lightsaber in Star wars. Here is the video
https://x.com/devtom7/status/1819743159213031453/
I found that the app AirDraw can export users' draw scenes to a USDZ file. So how can I implement this function using RealityKit?