ARKIT和现实作曲家缩放节点

发布于 2025-01-17 19:23:18 字数 442 浏览 0 评论 0原文

我正在尝试在 xcode 中创建一个节点,它将组合我从 RC 场景中获取的 2 个模型。

myTrack
myCar

它们都是单独对齐的,但它们有点太大了。 汽车正在使用一个循环,通过 JSON 控制它在轨道上的运动。

我想将它们添加到一个根节点并从那里使用管理缩放,

let mainAnchor = AnchorEntity(world: [0, 0, 0])
    
self.arView.scene.addAnchor(mainAnchor)
myTrackTransformed.addChild(mainAnchor)
myCar.addChild(mainAnchor)
    
mainAnchor.scale = [0.1, 0.1, 0.1]

但无论我放入缩放值,它们都不会执行任何操作。有什么想法吗?

I'm trying to create a node in xcode that will combine 2 of my models that I'm fetching from RC Scene.

myTrack
myCar

they both been aligned individually but they are a bit too big.
Car is using a loop that is controlling it movement around the track using JSON.

I want to add them to one root node and mange scale from there using

let mainAnchor = AnchorEntity(world: [0, 0, 0])
    
self.arView.scene.addAnchor(mainAnchor)
myTrackTransformed.addChild(mainAnchor)
myCar.addChild(mainAnchor)
    
mainAnchor.scale = [0.1, 0.1, 0.1]

but whatever I put in scale values they do nothing. Any ideas why?

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

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

发布评论

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

评论(1

妥活 2025-01-24 19:23:19

锚必须是父节点,反之亦然:

let mainAnchor = AnchorEntity()
    
mainAnchor.addChild(myTrack)
mainAnchor.addChild(myCar)
self.arView.scene.addAnchor(mainAnchor)
    
mainAnchor.scale /= 10

但请记住,您需要提取模型实体myTrack mycar )作曲家场景(rcscene.rcproject)。

The anchor must be a parent node, not vice versa:

let mainAnchor = AnchorEntity()
    
mainAnchor.addChild(myTrack)
mainAnchor.addChild(myCar)
self.arView.scene.addAnchor(mainAnchor)
    
mainAnchor.scale /= 10

But remember that you need to extract the model entities (myTrack and myCar) from the Reality Composer scene (RCScene.rcproject).

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