现实作曲家“在场景开始时隐藏全部”的故障

发布于 2025-01-12 00:26:26 字数 501 浏览 3 评论 0原文

我有一个包含多个场景的 Reality Composer 文件,所有场景一开始都是空的,然后每秒都会出现一些模型。尽管动画在 Quicklook 和 Reality Composer 中完美运行,但当我尝试将其与 Xcode 集成到我的应用程序中时,它会出现奇怪的故障。当第一个场景启动或当我们转到另一个场景时,它们不会开始为空。在一瞬间,我们看到该场景的所有模型都被显示,但又立即消失。

然后,我们看到它们按照预期慢慢出现。每个场景开始时模特的微小闪光都会毁掉一切。我尝试使用 .reality 文件和 .rcproject 文件,同样的问题。事实上,当我们在 Xcode 中预览 Reality 文件的动画时,它也会出现同样的问题。我尝试使用不同的隐藏和显示功能,没有变化。我尝试了不同的触发器,例如通知、场景启动、点击,没有变化。

我检查了很多教程,但仍然找不到我正在做的事情有什么问题。我几乎感觉 Reality Composer 当前的集成出现了故障。我真的很感激关于这个主题的一些想法......

I have a Reality Composer file with several scenes, all of which starts empty and then some models appear one by one every second. Even though the animation works perfectly in Quicklook and Reality Composer, it does a strange glitch when I try to integrate it in my app with Xcode. When the very first scene is launched or when we go to another scene, they don't start empty.. For a tiny split second, we see all the models of that scene being displayed, only to disappear immediately.

Then, we see them appearing slowly as they were supposed to. That tiny flash of models at the beginning of each scene is ruining everything. I tried using a .reality file and a .rcproject file, same problem. In fact, when we preview the animation of the Reality file inside Xcode, it does the same glitch. I tried using different Hide and Show functions, no change.. I tried different triggers such as notifications, scene start, on tap, no change.

I checked quite some tutorials and still couldn't find anything wrong in what I'm doing. I almost feel like there is a glitch in the current integration of Reality Composer. I would really appreciate some ideas on the subject...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蔚蓝源自深海 2025-01-19 00:26:26

尝试这样做以防止瞥见...

import UIKit
import RealityKit

class ViewController: UIViewController {
        
    @IBOutlet var arView: ARView!
    var box: ModelEntity!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let scene = try! Experience.loadScene()
        self.box = scene.cube!.children[0] as? ModelEntity
        self.box.isEnabled = false
        arView.scene.anchors.append(scene)
        
        DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
            self.box.isEnabled = true
        }
    }
}

在这种情况下,仅球体会出现故障。盒子对象工作正常。

输入图片此处描述

Try this to prevent a glimpse...

import UIKit
import RealityKit

class ViewController: UIViewController {
        
    @IBOutlet var arView: ARView!
    var box: ModelEntity!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let scene = try! Experience.loadScene()
        self.box = scene.cube!.children[0] as? ModelEntity
        self.box.isEnabled = false
        arView.scene.anchors.append(scene)
        
        DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
            self.box.isEnabled = true
        }
    }
}

In such a scenario glitching occurs only for sphere. Box object works fine.

enter image description here

著墨染雨君画夕 2025-01-19 00:26:26

@AndyJazz 谢谢。这个解决方案对我有用。或者行:

DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.box.isEnabled = true

我建议(在 Reality Composer 中)创建一个行为:
触发场​​景开始
动作表演

实体的外观还可以通过运动类型、缓动类型和样式进行调整,并链接到其他序列。

@AndyJazz Thanks. This solution works for me. Alternately to the line :

DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.box.isEnabled = true

I suggest (while in Reality Composer) Create a Behavior with:
Trigger Scene Start
Action Show

The appearance of the entity can then also be tweaked with a Motion Type, Ease Type and Style as well as chained to additional sequences.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文