Hi friend! I hope I correctly understood your question.
I don't know the possibility of doing it through a RealityComposer ,but I have a solution to how to do it through Xcode, like this.
1
Add your video file to Bundle
2
Add video player, and import AVKit
private var videoPlayer: AVPlayer!
3
Something like that
func obtainEntity() {
guard let path = Bundle.main.path(forResource: "Texture", ofType: "mp4") else { return }
let url = URL(fileURLWithPath: path)
let playerItem = AVPlayerItem(url: url)
videoPlayer = AVPlayer(playerItem: playerItem)
let mesh = MeshResource.generateSphere(radius: 0.03)
let material = VideoMaterial(avPlayer: videoPlayer)
entity = ModelEntity(mesh: mesh, materials: [material])
entity.generateCollisionShapes(recursive: true)
entity.setParent(anchorEntity)
videoPlayer.play()
arView.installGestures(.all, for: entity)
arView.scene.anchors.append(anchorEntity)
NotificationCenter.default.addObserver(self, selector: #selector(loopVideo), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: playerItem)
}
@objc
func loopVideo(notification: Notification) {
guard let playerItem = notification.object as? AVPlayerItem else { return }
playerItem.seek(to: CMTime.zero, completionHandler: nil)
videoPlayer.play()
}
Post
Replies
Boosts
Views
Activity
The problem was in the tracking configuration
let personSegmentation: ARWorldTrackingConfiguration.FrameSemantics = .personSegmentationWithDepth
if ARWorldTrackingConfiguration.supportsFrameSemantics(personSegmentation) {
configuration.frameSemantics.insert(personSegmentation)
}
There were people on the video and setting up the tracking configuration made them occlusion.
The only thing I thought, but I do not consider it the right decision
if (abs(worldCoords.y) < 1.241) { finalColor = float3(0.0); }