【问题标题】:How to scale and position a SCNNode that has a SCNSkinner attached?如何缩放和定位连接了 SCNSkinner 的 SCNNode?
【发布时间】:2019-11-14 19:49:46
【问题描述】:

使用 SceneKit,我正在加载一个 very simple .dae file,该 very simple .dae file 由一个带有三个相关骨骼的大圆柱体组成。我想缩小圆柱体并将其放置在地面上。这是代码

public class MyNode: SCNNode {

    public convenience init() {
        self.init()

        let scene = SCNScene(named: "test.dae")

        let cylinder = (scene?.rootNode.childNode(withName: "Cylinder", recursively: true))!

        let scale: Float = 0.1
        cylinder.scale = SCNVector3Make(scale, scale, scale)
        cylinder.position = SCNVector3(0, scale, 0)

        self.addChildNode(cylinder)
    }
}

这不起作用;当我查看它时,圆柱体仍然很大。我可以让代码工作的唯一方法是删除关联的SCNSKinner。

cylinder.skinner = nil

为什么会发生这种情况?如何正确缩放和定位模型、骨骼等?

【问题讨论】:

    标签: ios swift scenekit arkit scnnode


    【解决方案1】:

    当一个几何体被蒙皮时,它是由它的骨架驱动的。这意味着不再使用蒙皮节点的变换,重要的是骨骼的变换。

    对于这个文件,Armature 是骨架的根。如果你翻译/缩放这个节点而不是Cylinder,你会得到你想要的。

    【讨论】:

    • 如果“骨架”下面有严重的骨头会怎样。你怎么能分别操纵它们
    • 在我在这里写下评论后,我发现了如何使用 Blender 中设计的动画。 stackoverflow.com/questions/62099232/…
    猜你喜欢
    • 2016-05-19
    • 1970-01-01
    • 2016-03-25
    • 2018-08-04
    • 2018-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-10
    相关资源
    最近更新 更多